pre_delete_attachment

pre_delete_attachment

Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.5.2

apply_filters('pre_delete_attachment') is found 1 times:

  • /wp-includes/post.php line 6345
    	 * @param WP_Post|false|null $delete       Whether to go forward with deletion.
    	 * @param WP_Post            $post         Post object.
    	 * @param bool               $force_delete Whether to bypass the Trash.
    	 */
    	$check = apply_filters( 'pre_delete_attachment', null, $post, $force_delete );
    	if ( null !== $check ) {
    		return $check;
    	}
    
    	delete_post_meta( $post_id, '_wp_trash_meta_status' );
    	delete_post_meta( $post_id, '_wp_trash_meta_time' );
    

See this hook used in plugins: