delete_attachment
Fires before an attachment is deleted, at the start of wp_delete_attachment().
Использование
add_action( 'delete_attachment', 'wp_kama_delete_attachment_action', 10, 2 ); /** * Function for `delete_attachment` action-hook. * * @param int $post_id Attachment ID. * @param WP_Post $post Post object. * * @return void */ function wp_kama_delete_attachment_action( $post_id, $post ){ // action... }
- $post_id(int)
- Attachment ID.
- $post(WP_Post)
- Post object.
Список изменений
С версии 2.0.0 | Введена. |
С версии 5.5.0 | Added the $post parameter. |
Где вызывается хук
wp-includes/post.php 6602
do_action( 'delete_attachment', $post_id, $post );
Где используется хук в WordPress
wp-admin/includes/class-wp-site-icon.php 73
add_action( 'delete_attachment', array( $this, 'delete_attachment_data' ) );
wp-includes/default-filters.php 534
add_action( 'delete_attachment', '_delete_attachment_theme_mod' );