Open opicron opened 2 months ago
@opicron Can you please share which caching plugin you use?
I am using Cloudways as a host, they auto install the Breeze cache plugin. I know how to clear the cache. I think that clearing cache is something devs should hook into themselves.
It is not feasible to add all caching plugin clearing codes to your plugin. But adding a hook to do it might be a good idea. We can hook into it. The above code hooking into the post_meta update/add is a bit obscure and maybe not the best for all devs.
This is the code used for clearing cache on Cloudways Breeze plugin:
global $wp_filesystem;
if ( empty( $wp_filesystem ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
WP_Filesystem();
}
$url_path = get_permalink($post_id);
$cache_base_path = breeze_get_cache_base_path( false, 0 );
if ( $wp_filesystem->exists( $cache_base_path . hash( 'sha512', $url_path ) ) )
{
$wp_filesystem->rmdir( $cache_base_path . hash( 'sha512', $url_path ), true );
}
// Clear the varnish cache.
do_action( 'breeze_clear_varnish' );
I hope you agree to not add 'bloat' to the plugin by catering for cache refresh. After trying many Like Button plugins yours is the most lean and intresting to continue using.
There was one plugin that had 20 cache plugin refresh options implemented. While a FAQ on the wordpress page showing snippets to clear cache specific for a single provider would be fine.
If you can add do_action('after_vote',$post_id);
after updating the metadata anybody can hook anything they want :).
When using cache systems the browser is not updated after casting a vote/recommendation.
For now I hook
update_post_meta
andadded_post_meta
to check if the field_recommended
is set.It would be nice to use
add_action
to hook the pluginsdo_action
hook instead.