WordPress.org

Make WordPress Core

Changeset 16659


Ignore:
Timestamp:
12/01/10 19:11:47 (3 years ago)
Author:
ryan
Message:

Save meta id before performing actions since the insert_id can change. Props cyberhobo. fixes #15465

File:
1 edited

Legend:

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

    r16651 r16659  
    642642        wp_cache_delete($post_ID, 'post_meta'); 
    643643        $wpdb->insert( $wpdb->postmeta, array( 'post_id' => $post_ID, 'meta_key' => $metakey, 'meta_value' => $metavalue ) ); 
    644         do_action( 'added_postmeta', $wpdb->insert_id, $post_ID, $metakey, $metavalue ); 
    645  
    646         return $wpdb->insert_id; 
     644        $meta_id = $wpdb->insert_id; 
     645        do_action( 'added_postmeta', $meta_id, $post_ID, $metakey, $metavalue ); 
     646 
     647        return $meta_id; 
    647648    } 
    648649    return false; 
Note: See TracChangeset for help on using the changeset viewer.