feat: rejected-cookie cache exclusions for WooCommerce cart

Add wp_recache_rejected_cookies option (defaults: woocommerce_items_in_cart,
wp_woocommerce_session_*, wp-postpass, comment_author_*, wordpress_*) that
bypasses page cache when any listed cookie is present. Both the WP-level
check (wp_recache_should_exclude) and the standalone drop-in apply the
same exact/prefix matching logic. Editing the option regenerates the
drop-in and purges all cache.
This commit is contained in:
2026-09-13 15:43:20 +02:00
parent 43081d6e5d
commit 65657276f6
7 changed files with 206 additions and 4 deletions
+13
View File
@@ -52,6 +52,19 @@ $stats = WP_Recache_Admin::get_cache_stats();
<p class="description">One URL per line. These pages will not be cached.</p>
</td>
</tr>
<tr>
<th scope="row">Rejected Cookies</th>
<td>
<textarea name="wp_recache_rejected_cookies" rows="5" cols="50" class="large-text"><?php echo esc_textarea(implode("\n", get_option('wp_recache_rejected_cookies', [
'woocommerce_items_in_cart',
'wp_woocommerce_session_*',
'wp-postpass',
'comment_author_*',
'wordpress_*',
]))); ?></textarea>
<p class="description">One cookie name per line. Visitors with these cookies bypass the cache. Use <code>*</code> as a suffix to match a prefix (e.g. <code>comment_author_*</code>).</p>
</td>
</tr>
</table>
<h2>Cache Statistics</h2>