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:
parent
1065472816
commit
e999b49423
@ -641,9 +641,10 @@ function add_meta( $post_ID ) {
|
|||||||
|
|
||||||
wp_cache_delete($post_ID, 'post_meta');
|
wp_cache_delete($post_ID, 'post_meta');
|
||||||
$wpdb->insert( $wpdb->postmeta, array( 'post_id' => $post_ID, 'meta_key' => $metakey, 'meta_value' => $metavalue ) );
|
$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;
|
return false;
|
||||||
} // add_meta
|
} // add_meta
|
||||||
|
Loading…
Reference in New Issue
Block a user