I'm currently working on developing a plugin with a custom post type of "Dealer Location". (Not relevant to question, just a bit of background)
When a post is in the trash and "delete permanently" is pressed, I need to remove this piece of meta from each user.
When a post/posts are in the trash and "empty trash" is pressed, I need to run through EACH location being deleted and do something.
I have an extremely basic function just to test when it runs right now, as I have all the other nuts & bolts (removing user meta, etc) figured out..:
public function wcmdl_remove_deleted_location_users(){
die;
}
And the action I'm using is..:
$this->loader->add_action('before_delete_post', $plugin_admin, 'wcmdl_remove_deleted_location_meta');
I've tried using the hook 'delete_post' too and in both cases the function fires when expected. However, it fires on BOTH "delete permanently" AND "empty trash".
Is there any sort of hook or if statement I can use to differentiate between mass-deleting and single-deleting in this instance? If not, would it be viable to pass some value via ajax/js depending on which button is pressed, and use it to determine the action taken in a function via an if/else statement?