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 deleted
I 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_post
anyways) 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() );