update_postmeta
Fires immediately before updating a post's metadata.
Usage
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(string)
- Metadata key.
- $meta_value(mixed)
- 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.
Changelog
Since 2.9.0 | Introduced. |
Where the hook is called
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 946
do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );