mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Update update_post_meta() and delete_post_meta() to work with post revisions. Props misterbisson. fixes #7925
git-svn-id: http://svn.automattic.com/wordpress/trunk@9252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8c07e41ba3
commit
14aeedc5ef
@ -548,7 +548,9 @@ function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
|
||||
function delete_post_meta($post_id, $meta_key, $meta_value = '') {
|
||||
global $wpdb;
|
||||
|
||||
$post_id = absint( $post_id );
|
||||
// make sure meta is added to the post, not a revision
|
||||
if ( $the_post = wp_is_post_revision($post_id) )
|
||||
$post_id = $the_post;
|
||||
|
||||
// expected_slashed ($meta_key, $meta_value)
|
||||
$meta_key = stripslashes( $meta_key );
|
||||
@ -626,6 +628,10 @@ function get_post_meta($post_id, $key, $single = false) {
|
||||
function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
|
||||
global $wpdb;
|
||||
|
||||
// make sure meta is added to the post, not a revision
|
||||
if ( $the_post = wp_is_post_revision($post_id) )
|
||||
$post_id = $the_post;
|
||||
|
||||
// expected_slashed ($meta_key)
|
||||
$meta_key = stripslashes($meta_key);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user