Repository navigation
Conversation
There was a problem hiding this comment.
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 viawp_verify_nonce()and removes the$valid_nonceglobal dependency. - Enhances the config replacement regex so it matches both single-quoted and double-quoted
$wp_cache_pages[...]keys when updatingwp-cache-config.php.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kraftbj
force-pushed
the
cherry-pick/487-rejected-pages-improvements
branch
from
April 7, 2026 22:03
e023a4f to
8b6daef
Compare
…cted-pages-improvements # Conflicts: # wp-cache.php
Trunk moved wp_cache_update_rejected_pages() out of wp-cache.php, so the merge took trunk's wp-cache.php. Apply the same change where the function now lives.
Both callers set $valid_nonce first: the settings page from the same wp-cache nonce, and the REST endpoint to true. The second check could never change the result.
kraftbj
marked this pull request as ready for review
November 11, 2026 21:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()(now ininc/settings-forms.php):$wp_cache_pages['search']and$wp_cache_pages["search"]), with any spacing, preventing stale entries when the quote style in the config doesn't match the hardcoded pattern.empty(): A posted0or empty value now saves as 0 instead of 1.The nonce handling from #487 isn't included. Both callers already set
$valid_noncebefore calling this function (the settings page from the samewp-cachenonce, the REST endpoint totrue), so an inline check couldn't change the result.See #487