Simplify action placement in update_metadata().

By combining a number of `foreach` loops, we make the code more readable and
potentially faster in the case where many metadata rows are being updated.

Props Shelob9.
Fixes #35652.

git-svn-id: https://develop.svn.wordpress.org/trunk@36420 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2016-01-29 04:51:11 +00:00
parent b27ed68003
commit fdd7d91162

View File

@ -227,10 +227,8 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
* @param mixed $meta_value Meta value.
*/
do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
}
if ( 'post' == $meta_type ) {
foreach ( $meta_ids as $meta_id ) {
if ( 'post' == $meta_type ) {
/**
* Fires immediately before updating a post's metadata.
*
@ -266,10 +264,8 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
* @param mixed $meta_value Meta value.
*/
do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
}
if ( 'post' == $meta_type ) {
foreach ( $meta_ids as $meta_id ) {
if ( 'post' == $meta_type ) {
/**
* Fires immediately after updating a post's metadata.
*