[wp-trac] [WordPress Trac] #20299: Preview changes on a published post makes all post meta "live"

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 20 20:50:03 UTC 2012


#20299: Preview changes on a published post makes all post meta "live"
--------------------------+------------------------------
 Reporter:  jakemgold     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.3.1
 Severity:  major         |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by mintindeed):

 You'd probably want to exclude some post meta that are specific to the
 main post, like edit locks.  I imagine the patch would look something like
 this:


 {{{
 $exclude_meta_keys = apply_filters( 'revision_meta_do_not_copy', array(
         '_encloseme',
         '_pingme',
         '_edit_last',
         '_edit_lock'
 ) );
 $current_meta = get_post_custom( $GLOBALS['post'] );
 if ( is_array( $current_meta ) ) {
         foreach ( $current_meta as $meta_key => $meta_value ) {
                 if ( in_array( $meta_key, $exclude_meta_keys ) ) {
                         continue;
                 }

                 update_post_meta( $revision_id, $meta_key, $meta_value );
         }
 }

 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20299#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list