Compare custom taxonomies of updated post (or new post) [Updated with progress]

Use the set_object_terms hook, http://adambrown.info/p/wp_hooks/hook/set_object_terms?version=3.4&file=wp-includes/taxonomy.php It should be fired when a post or page is modified. Here is the code that fires it: do_action(‘set_object_terms’, $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids); You can thus check against the $object_id and taxonomy, and flush your transient cache and regenerate as needed. Specifically, clear the term caches of the … Read more

Why not fire the save_post event?

The save_post action hook fires after a post is saved: every time, even for autosaves. If you look at the reference for save_post, you’ll see that the callback receives three parameters: the first is an integer $post_ID, the second is a WP_Post object $post, and the third is a boolean $update. None of the parameters … Read more

Clear cache on post of one type when something happens to post of other type

I suppose a quick and dirty way to achieve what you want is to clear the entire site cache, something like this: function clear_rocket_cache_on_post_save() { rocket_clean_domain(); } add_action( ‘save_post’, ‘clear_rocket_cache_on_post_save’ ); Otherwise you’ll need to do a query to get the matching post, something like this should work: function clear_rocket_cache_on_post_save( $post_id ) { // $result_id … Read more

save_post requiere at least one uploaded file to be published

I didn’t test this, but it should work: function check_post_attachments($post_id, $post){ if(empty(get_posts(array(‘post_type’ => ‘attachment’, ‘post_parent’ => $post_id)))){ $post[‘post_status’] = ‘draft’; wp_update_post($post); } } add_action(‘save_post’, ‘check_post_attachments’);