Skip to content

Commit 8a870e3

Browse files
committed
fix: Update clear cache function.
1 parent 7e37fb2 commit 8a870e3

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

inc/lib/init.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -341,19 +341,10 @@ function truncate_excerpt_length($length)
341341
// Clear cache on options save
342342
function clear_cache_options_save($post_id)
343343
{
344-
$screen = get_current_screen();
345-
346-
if (strpos($screen->id, 'general-options') == true && $post_id == 'general-options') {
347-
// Clear object cache
348-
wp_cache_flush();
349-
350-
// Check if class WpeCommon exists
351-
if (class_exists('\WpeCommon')) {
352-
error_log('WpeCommon exists');
353-
354-
WpeCommon::purge_memcached();
355-
WpeCommon::purge_varnish_cache();
356-
}
357-
}
344+
// Check if it's an options page
345+
if ($post_id === 'options') {
346+
// Flush the object cache
347+
wp_cache_flush();
348+
}
358349
}
359350
add_action('acf/save_post', __NAMESPACE__ . '\\clear_cache_options_save', 20);

0 commit comments

Comments
 (0)