Title: Multiple object types
Last modified: November 4, 2022

---

# Multiple object types

 *  Resolved [Bruno Braga](https://wordpress.org/support/users/brunobragaw8t/)
 * (@brunobragaw8t)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/multiple-object-types/)
 * Hi
 * Our team would like for the cache entry to be cleared depending on updates of
   2 or more post types.
 * Is this possible? If so, how?
 * We tried passing it an array and a comma-separated string. None of these worked.
 * Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * (@rockfire)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/multiple-object-types/#post-16164733)
 * Hi [@brunobragaw8t](https://wordpress.org/support/users/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.
 *  Thread Starter [Bruno Braga](https://wordpress.org/support/users/brunobragaw8t/)
 * (@brunobragaw8t)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/multiple-object-types/#post-16166150)
 * Hi!
 * That’s actually exactly what we ended up doing in order to get around the issue.
 * Thanks for the reply anyway!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Multiple object types’ is closed to new replies.

 * ![](https://ps.w.org/wp-rest-cache/assets/icon-256x256.png?rev=3328849)
 * [WP REST Cache](https://wordpress.org/plugins/wp-rest-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-rest-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-rest-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-rest-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-rest-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-rest-cache/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Bruno Braga](https://wordpress.org/support/users/brunobragaw8t/)
 * Last activity: [3 years, 7 months ago](https://wordpress.org/support/topic/multiple-object-types/#post-16166150)
 * Status: resolved