ID] ?? []; $actions = [ 'flush_cache' => 'Flush page cache', ]; $events = [ 'on_update_post_type' => 'On publish/update any post in post type', ]; $post_types = get_post_types(['public' => true], 'objects'); ?>

Create rules to automatically manage BerqWP cache for this page.

$rule): ?>
Action Event Post Type Delete
sanitize_text_field($rule['action'] ?? ''), 'event' => sanitize_text_field($rule['event'] ?? ''), 'post_type' => sanitize_text_field($rule['post_type'] ?? ''), ]; }, $_POST['berqwp_rules']); $rules[$post_id] = $clean_rules; // update_post_meta($post_id, '_berqwp_cache_rules', $clean_rules); update_option('berqwp_cache_rules', $rules, false); } else { unset($rules[$post_id]); update_option('berqwp_cache_rules', $rules, false); } } function apply_rules($post_id, $post, $update) { // Ignore auto-saves, revisions, etc. if (wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) return; global $berq_log; $page_url = get_permalink($post_id); $rules = get_option('berqwp_cache_rules'); if (!is_array($rules)) $rules = []; if (empty($rules)) { return; } foreach ($rules as $key => $value) { $rules_matched_post_type = array_filter($value, function ($item) use ($post) { return $item['post_type'] === $post->post_type; }); foreach ($rules_matched_post_type as $rule) { if ($rule['event'] === 'on_update_post_type') { if ($rule['post_type'] === $post->post_type) { if ($rule['action'] === 'flush_cache') { berqCache::purge_page($page_url, true); $berq_log->info("Rule triggered - event: {$rule['event']} post type: {$rule['post_type']} action: {$rule['action']}"); } } } } } } } new berqPageRules();