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

git-svn-id: http://svn.automattic.com/wordpress/trunk@16659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-12-01 19:11:47 +00:00
parent 1065472816
commit e999b49423
1 changed files with 3 additions and 2 deletions

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