update_postmeta
Fires immediately before updating a post's metadata.
Использование
add_action( 'update_postmeta', 'wp_kama_update_postmeta_action', 10, 4 ); /** * Function for `update_postmeta` action-hook. * * @param int $meta_id ID of metadata entry to update. * @param int $object_id Post ID. * @param string $meta_key Metadata key. * @param mixed $meta_value Metadata value. This will be a PHP-serialized string representation of the value if the value is an array, an object, or itself a PHP-serialized string. * * @return void */ function wp_kama_update_postmeta_action( $meta_id, $object_id, $meta_key, $meta_value ){ // action... }
- $meta_id(int)
- ID of metadata entry to update.
- $object_id(int)
- Post ID.
- $meta_key(строка)
- Metadata key.
- $meta_value(разное)
- Metadata value. This will be a PHP-serialized string representation of the value if the value is an array, an object, or itself a PHP-serialized string.
Список изменений
С версии 2.9.0 | Введена. |
Где вызывается хук
update_postmeta
update_postmeta
wp-includes/meta.php 304
do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
wp-includes/meta.php 945
do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );