Skip to content

Fix: improve rejected pages config handling and nonce verification#1025

Draft
kraftbj wants to merge 3 commits into
trunkfrom
cherry-pick/487-rejected-pages-improvements
Draft

Fix: improve rejected pages config handling and nonce verification#1025
kraftbj wants to merge 3 commits into
trunkfrom
cherry-pick/487-rejected-pages-improvements

Conversation

@kraftbj
Copy link
Copy Markdown
Contributor

@kraftbj kraftbj commented Apr 7, 2026

Summary

Cherry-picks the still-relevant changes from closed PR #487 ("Improve wp-cache config functions"), adapted to the current codebase.

Originally proposed by @stodorovic in #487.

Changes to wp_cache_update_rejected_pages():

  • Improved regex for config replacement: The regex now handles both single-quoted and double-quoted array keys in the config file ($wp_cache_pages['search'] and $wp_cache_pages["search"]), preventing stale entries when the quote style in the config doesn't match the hardcoded pattern.
  • Inline nonce verification: Replaced reliance on the $valid_nonce global with a direct wp_verify_nonce() call, making the security check self-contained and explicit.
  • Removed unnecessary global: Dropped the $valid_nonce global declaration since it is no longer used.

See #487

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates how rejected page-type caching settings are persisted to the WP Super Cache config, improving config line matching and making nonce verification explicit within wp_cache_update_rejected_pages().

Changes:

  • Updates wp_cache_update_rejected_pages() to verify the nonce inline via wp_verify_nonce() and removes the $valid_nonce global dependency.
  • Enhances the config replacement regex so it matches both single-quoted and double-quoted $wp_cache_pages[...] keys when updating wp-cache-config.php.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread wp-cache.php Outdated
@kraftbj kraftbj force-pushed the cherry-pick/487-rejected-pages-improvements branch from e023a4f to 8b6daef Compare April 7, 2026 22:03
@kraftbj kraftbj requested a review from donnchawp April 7, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants