add_action( 'delete_post', 'test_function' );
function test_function(){
echo "Hello!";
}
The “Hello!” isn’t showing up when I delete a post (It is a custom post-type, but that shouldn’t matter right?). How do I debug this?
EDIT: I can’t put that code in any front-end files like header.php or index.php because I won’t be able to view the output when I delete a post from the back-end. What’s the best way to tackle this?
Thanks
Try doing the following to see if you are reaching your filter. I tested this here with 3.2.1 and it works fine for me.
this action will not run until you delete the post from the trash.
If you want it to run when you move it to the trash the action is ‘trash_post’.