Call function on multiple actions
-
I’m writing some function that needs to be executed every time something changes in the list of posts. So, whenever:
– a new post is published
– an existing post is edited
– an existing post is deletedI was thinking to do it like this:
add_action('publish_post', myfunction()); add_action('post_updated', myfunction()); add_action('deleted_post', myfunction());I think the second one is not even necessary (it’s executed with
publish_postanyways) but is there a better way to do this, instead of calling the function in various situations?Is it possible to do something like this (not literally, but structure-wise)?
add_action( ('publish_post' OR 'post_updated' OR 'deleted_post') , myfunction() );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Call function on multiple actions’ is closed to new replies.