mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-28 23:27:39 +02:00
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. Built from https://develop.svn.wordpress.org/trunk@36420 git-svn-id: http://core.svn.wordpress.org/trunk@36387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
34b9af6efd
commit
bb6a068e29
@ -227,10 +227,8 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
|
|||||||
* @param mixed $meta_value Meta value.
|
* @param mixed $meta_value Meta value.
|
||||||
*/
|
*/
|
||||||
do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
|
do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
|
||||||
}
|
|
||||||
|
|
||||||
if ( 'post' == $meta_type ) {
|
if ( 'post' == $meta_type ) {
|
||||||
foreach ( $meta_ids as $meta_id ) {
|
|
||||||
/**
|
/**
|
||||||
* Fires immediately before updating a post's metadata.
|
* 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.
|
* @param mixed $meta_value Meta value.
|
||||||
*/
|
*/
|
||||||
do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
|
do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
|
||||||
}
|
|
||||||
|
|
||||||
if ( 'post' == $meta_type ) {
|
if ( 'post' == $meta_type ) {
|
||||||
foreach ( $meta_ids as $meta_id ) {
|
|
||||||
/**
|
/**
|
||||||
* Fires immediately after updating a post's metadata.
|
* Fires immediately after updating a post's metadata.
|
||||||
*
|
*
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-alpha-36419';
|
$wp_version = '4.5-alpha-36420';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user