[ad_1]
Hi @brunobragaw8t
Thank you for using our plugin!
We do not have support for multiple post types per cache record at this time. You could however achieve the same result with a simple filter where you clear the caches of posttype2 if posttype1 is saved (and the other way around):
add_filter( 'save_post', 'wprc_clear_caches_on_save', 10, 2 );
function wprc_clear_caches_on_save( $post_id, $post ) {
if ( 'auto-draft' === $post->post_status || ! in_array( $post->post_type, [ 'postype1', 'posttype2' ] ) {
return;
}
$post_type = ( 'posttype1' === $post->post_type ? 'posttype2' : 'posttype1' );
$caching = \WP_Rest_Cache_Plugin\Includes\Caching\Caching::get_instance();
$caching->delete_object_type_caches( $post_type );
}N.B. I typed this without testing it, so there may be some small errors in it, but the principle would remain the same.
Hi!
That’s actually exactly what we ended up doing in order to get around the issue.
Thanks for the reply anyway!
