Make WordPress Core


Ignore:
Timestamp:
11/22/2005 12:36:36 AM (21 years ago)
Author:
ryan
Message:

Update meta before updating the post so that page_template is not stomped. fixes #1933

File:
1 edited

Legend:

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

    r3142 r3190  
    511511meta_key = '$key' AND post_id = '$post_id'");
    512512        $cache_key = $post_meta_cache['$post_id'][$key];
    513         foreach ($cache_key as $index => $data)
    514             $post_meta_cache['$post_id'][$key][$index] = $original_value;
     513        if ( !empty($cache_key) )
     514            foreach ($cache_key as $index => $data)
     515                $post_meta_cache['$post_id'][$key][$index] = $original_value;
    515516    } else {
    516517        $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = '$value' WHERE
    517518meta_key = '$key' AND post_id = '$post_id' AND meta_value = '$prev_value'");
    518519        $cache_key = $post_meta_cache['$post_id'][$key];
    519         foreach ($cache_key as $index => $data)
    520             if ( $data == $original_prev )
    521                 $post_meta_cache['$post_id'][$key][$index] = $original_value;
     520        if ( !empty($cache_key) )
     521            foreach ($cache_key as $index => $data)
     522                if ( $data == $original_prev )
     523                    $post_meta_cache['$post_id'][$key][$index] = $original_value;
    522524    }
    523525
Note: See TracChangeset for help on using the changeset viewer.