wp_trash_post
Fires before a post is sent to the Trash.
Использование
add_action( 'wp_trash_post', 'wp_kama_trash_post_action', 10, 2 );
/**
* Function for `wp_trash_post` action-hook.
*
* @param int $post_id Post ID.
* @param string $previous_status The status of the post about to be trashed.
*
* @return void
*/
function wp_kama_trash_post_action( $post_id, $previous_status ){
// action...
}
- $post_id(int)
- Post ID.
- $previous_status(строка)
- The status of the post about to be trashed.
Список изменений
| С версии 3.3.0 | Введена. |
| С версии 6.3.0 | Added the $previous_status parameter. |
Где вызывается хук
wp_trash_post
wp-includes/post.php 4126
do_action( 'wp_trash_post', $post_id, $previous_status );
wp-includes/class-wp-customize-manager.php 3099
do_action( 'wp_trash_post', $post_id, $previous_status );
Где используется хук в WordPress
wp-includes/default-filters.php 595
add_action( 'wp_trash_post', '_reset_front_page_settings_for_post' );