Fix 9296: Enable custom Settings API fields in Permalinks page #9199
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.
Problem
The WordPress Permalinks settings page (
options-permalink.php
) was not processing custom settings that were registered through the WordPress Settings API. While developers could add custom settings to the page usingregister_setting()
with the 'permalink' group, these settings would not persist when the form was submitted.Root Cause
The root cause was that
options-permalink.php
lacked the necessary code to process and save custom settings registered through the Settings API. While WordPress provides the infrastructure to register settings with the 'permalink' group, the permalinks page wasn't implementing the logic to handle these settings during form submission.Solution
Added code to
options-permalink.php
to properly handle custom settings:This addition:
Example Usage
For developers looking to add custom permalink settings, here's how to properly register a setting:
Impact
This enhancement enables developers to properly extend the Permalinks settings page using the WordPress Settings API, improving the platform's extensibility while maintaining consistency with WordPress coding standards and best practices.
Trac Link