mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +00:00
Update meta before updating the post so that page_template is not stomped. fixes #1933
git-svn-id: https://develop.svn.wordpress.org/trunk@3190 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -510,15 +510,17 @@ function update_post_meta($post_id, $key, $value, $prev_value = '') {
|
||||
$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = '$value' WHERE
|
||||
meta_key = '$key' AND post_id = '$post_id'");
|
||||
$cache_key = $post_meta_cache['$post_id'][$key];
|
||||
foreach ($cache_key as $index => $data)
|
||||
$post_meta_cache['$post_id'][$key][$index] = $original_value;
|
||||
if ( !empty($cache_key) )
|
||||
foreach ($cache_key as $index => $data)
|
||||
$post_meta_cache['$post_id'][$key][$index] = $original_value;
|
||||
} else {
|
||||
$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = '$value' WHERE
|
||||
meta_key = '$key' AND post_id = '$post_id' AND meta_value = '$prev_value'");
|
||||
$cache_key = $post_meta_cache['$post_id'][$key];
|
||||
foreach ($cache_key as $index => $data)
|
||||
if ( $data == $original_prev )
|
||||
$post_meta_cache['$post_id'][$key][$index] = $original_value;
|
||||
if ( !empty($cache_key) )
|
||||
foreach ($cache_key as $index => $data)
|
||||
if ( $data == $original_prev )
|
||||
$post_meta_cache['$post_id'][$key][$index] = $original_value;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user