Title: How to delete specific object type cache programmatically
Last modified: December 14, 2019

---

# How to delete specific object type cache programmatically

 *  Resolved [eljara](https://wordpress.org/support/users/sawasblog/)
 * (@sawasblog)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/how-to-delete-specific-object-type-cache-programmatically/)
 * Hi first of all i would like to thank you for this great plugin that made my 
   blog much faster.
 * Now, i would like to create a custom end point that trigger deleting cache for
   a specific object type , for example every time a user likes a comment the “notification”
   object type must be flushed .
 * I hope there will be a simple function that i can put in my function theme file
   and call every time ” my liking function ” is called
 * thank you

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

 *  Plugin Author [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * (@rockfire)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/how-to-delete-specific-object-type-cache-programmatically/#post-12239742)
 * Hi [@sawasblog](https://wordpress.org/support/users/sawasblog/)
 * Thank you for using our plugin!
 * What you want is easy 🙂 Simply add the following code at the end of your “my
   liking function”:
    `\WP_Rest_Cache_Plugin\Includes\Caching\Caching::get_instance()-
   >delete_object_type_caches( 'notification' );`
 * Please let us know if this works for you or if you have any other questions!
 *  [menathor](https://wordpress.org/support/users/menathor/)
 * (@menathor)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/how-to-delete-specific-object-type-cache-programmatically/#post-12298495)
 * Awesome, I was looking for this too!
 *  Plugin Author [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * (@rockfire)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/how-to-delete-specific-object-type-cache-programmatically/#post-12299207)
 * Hi [@menathor](https://wordpress.org/support/users/menathor/)
 * Great! Please let us know if you need any more help!

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

The topic ‘How to delete specific object type cache programmatically’ 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/)

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)

 * 3 replies
 * 3 participants
 * Last reply from: [Richard Korthuis](https://wordpress.org/support/users/rockfire/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/how-to-delete-specific-object-type-cache-programmatically/#post-12299207)
 * Status: resolved