Viewing 1 replies (of 1 total)
  • Thread Starter nomadandinlove

    (@nomadandinlove)

    I came up with this but it’s not working. Any tips?

    function custom_cache_enabler_clear_on_update($post_id, $post) {
    // Get the post type
    $post_type = get_post_type($post_id);

    // Specify post types that should not trigger a cache clear
    $excluded_post_types = ['post', 'category', 'tag'];

    // If the post type is in the excluded list, return false to prevent cache clearing
    if (in_array($post_type, $excluded_post_types)) {
    return false;
    }

    // Default action (clear cache) for other post types
    return true;
    }

    add_filter('ce_clear_on_update', 'custom_cache_enabler_clear_on_update', 10, 2);
Viewing 1 replies (of 1 total)
  • The topic ‘Prevent Taxonomy Pages from Clearing Cache when Updating or Saving Post’ is closed to new replies.