Repository navigation
Return null from wp_get_global_settings() and wp_get_global_styles() for missing paths - #13752
Open
devansh016 wants to merge 3 commits into
Open
devansh016 wants to merge 3 commits into
devansh016 wants to merge 3 commits into
Conversation
…aths. Fixes #66183.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
When a
$pathis passed towp_get_global_settings()orwp_get_global_styles()and that path does not exist, both functions return the entire settings/styles array. This happens because the full array is passed as the fallback to_wp_array_get(). Callers cannot tell "not set" apart from "all settings"This PR:
nullfrom both functions when the requested path does not exist. An empty$pathstill returns everything, as before.block_core_image_get_lightbox_settings()in the Image block. It relied on the old behaviour to fall back to the top-levellightboxsetting, and now also falls back when the block-level lookup returnsnull. It works under both the old and new behaviour. A matching change is needed in Gutenberg (packages/block-library/src/image/index.php), since that file is synced from there.Other core callers that pass a path (
button.php,block-supports/states.php,block-supports/block-visibility.php, and thewp_get_global_styles( array( 'color' ) )call inimage.php) already handlenull.Trac ticket: https://core.trac.wordpress.org/ticket/66183
Use of AI Tools
AI assistance: Yes
Tool(s): Claude
Model(s): Opus 5.5
Used for: Initial code skeleton and test suggestions; final implementation and tests were reviewed and edited by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.