mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 10:44:26 +00:00
Add non-existent values instead of returning g false in update_post_meta(). Props filosofo. fixes #7018
git-svn-id: https://develop.svn.wordpress.org/trunk@7978 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -577,8 +577,9 @@ function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
|
||||
// expected_slashed ($meta_key)
|
||||
$meta_key = stripslashes($meta_key);
|
||||
|
||||
if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) )
|
||||
return false;
|
||||
if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) {
|
||||
return add_post_meta($post_id, $meta_key, $meta_value);
|
||||
}
|
||||
|
||||
$data = compact( 'meta_value' );
|
||||
$where = compact( 'meta_key', 'post_id' );
|
||||
|
||||
Reference in New Issue
Block a user