WordPress.org

Make WordPress Core

Changeset 9252


Ignore:
Timestamp:
10/20/08 05:47:13 (6 years ago)
Author:
markjaquith
Message:

Update update_post_meta() and delete_post_meta() to work with post revisions. Props misterbisson. fixes #7925

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r9242 r9252  
    549549    global $wpdb; 
    550550 
    551     $post_id = absint( $post_id ); 
     551    // make sure meta is added to the post, not a revision 
     552    if ( $the_post = wp_is_post_revision($post_id) ) 
     553        $post_id = $the_post; 
    552554 
    553555    // expected_slashed ($meta_key, $meta_value) 
     
    626628function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') { 
    627629    global $wpdb; 
     630 
     631    // make sure meta is added to the post, not a revision 
     632    if ( $the_post = wp_is_post_revision($post_id) ) 
     633        $post_id = $the_post; 
    628634 
    629635    // expected_slashed ($meta_key) 
Note: See TracChangeset for help on using the changeset viewer.