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 = tax query by $post_id
       rocket_clean_post( $result_id );

  }
  add_action( 'save_post', 'clear_rocket_cache_on_post_save' );

You can find more information on WordPress’s “out of the box” caching features here: https://codex.wordpress.org/Transients_API

and here: https://codex.wordpress.org/Class_Reference/WP_Object_Cache

Many themes do not utilize this core functionality, but it’s there.

UPDATE:

If you’re not getting debugging output on your screen, the best way to figure out why you’re getting errors is to use the debug.log.

First, put this snippet at the bottom of your functions.php file.

if (!function_exists('write_log')) {
    function write_log ( $log )  {
        if ( true === WP_DEBUG ) {
            if ( is_array( $log ) || is_object( $log ) ) {
                error_log( print_r( $log, true ) );
            } else {
                error_log( $log );
            }
        }
    }
}

Then edit your wp-config.php file to include these:

define( 'WP_DEBUG', true);
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );

Then in your wp-content folder create a new file called debug.log. Now you are ready to debug.

Now whatever you want to output you use the function write_log($some_variable) and it’ll output your debugging errors to debug.log. Do that and I bet you’ll see why you’re getting a WSOD. /happy coding