delete_attachment action-hook . WP 2.0.0
Fires before an attachment is deleted, at the start of wp_delete_attachment().
Usage
add_action( 'delete_attachment', 'action_function_name_6802', 10, 2 ); function action_function_name_6802( $post_id, $post ){ // action... }
- $post_id(int)
- Attachment ID.
- $post(WP_Post)
- Post object.
Changelog
Since 2.0.0 | Introduced. |
Since 5.5.0 | Added the $post parameter. |
Where the hook is called
wp-includes/post.php 5940
do_action( 'delete_attachment', $post_id, $post );
Where in WP core the hook is used WordPress
wp-includes/post.php 72
add_action( 'delete_attachment', array( $this, 'delete_attachment_data' ) );
wp-includes/post.php 482
add_action( 'delete_attachment', '_delete_attachment_theme_mod' );