do_action( ‘before_delete_post’, int $postid, WP_Post $post ); This hook is executed just before a post is deleted, at the start of wp_delete_post(). Example: add_action( ‘before_delete_post’, ‘before_delete_project’, 99, 2 ); function before_delete_project( $postID, $post ) { if ( ‘project’ == $post->post_type ) { var_dump(‘Okay, we are good.’); return; } // My custom stuff for deleting my custom post type here } […]

June 17, 2022

Close