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

git-svn-id: https://develop.svn.wordpress.org/trunk@16659 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-12-01 19:11:47 +00:00
parent bf8b057f04
commit b9b0e7215c

View File

@ -641,9 +641,10 @@ function add_meta( $post_ID ) {
wp_cache_delete($post_ID, 'post_meta');
$wpdb->insert( $wpdb->postmeta, array( 'post_id' => $post_ID, 'meta_key' => $metakey, 'meta_value' => $metavalue ) );
do_action( 'added_postmeta', $wpdb->insert_id, $post_ID, $metakey, $metavalue );
$meta_id = $wpdb->insert_id;
do_action( 'added_postmeta', $meta_id, $post_ID, $metakey, $metavalue );
return $wpdb->insert_id;
return $meta_id;
}
return false;
} // add_meta