Flush cache when another plugins fires an action (noob here)
-
Hey! Sorry for the noob question; It’s been a long time since I’ve worked with PHP and was never really that good with it (I’m more a Front-End guy)
I’m using a plugin that syncs my Lightroom galleries to WordPress (WP/LR, really nice) – and whenever WP/LR updates a collection inside of WordPress, I would like to flush (or delete?!) my handwritten custom endpoint for that collection.
add_action('wplr_update_collectiongallery', function($collectionId, $collection) { // ... preparing stuff to update a post // Update the post into the database wp_update_post($post_data); // flush WP REST cache if (function_exists('delete_cache_by_endpoint')) { delete_cache_by_endpoint('phototastisch/v1/albums'); // path will obviously come from a parameter } }, 10, 2);
As of right now this is not flushing/deleting anything. I don’t know how to debug this properly; my guess is that the
if function_exists
is falsy and thatdelete_cache_by_endpoint
does not exist in my custom plugin file/wp-plugins/phototastisch/phototastisch.php
Can you tell me how I can flush/delete (whats the difference anyways?) in this action?
Thanks a lot!
- The topic ‘Flush cache when another plugins fires an action (noob here)’ is closed to new replies.