How to cancel an action hooked to untrash_post? or any hook
I want to do the following in a plugin:
- hook to untrash_post
with a custom function
- do some checking inside custom function
- cancel actual post restoring (untrashing)
I've tried with remove_action
but doesn't seem to work.
Can you point me into the right direction?
Code sample:
add_action( 'untrash_post', array( __CLASS__, 'static_untrash_handler' ) );
.....
public static function static_untrash_handler( $post ) {
// check stuff
// prevent post from being restored. How ?
}
Should I return something to 'break the cycle' ?
Thank you in advance!