This repository was archived by the owner on Feb 17, 2025. It is now read-only.
Varia: check for $post on widgets screen before adding admin body classes#8556
Open
Varia: check for $post on widgets screen before adding admin body classes#8556
$post on widgets screen before adding admin body classes#8556Conversation
… warning on the widgets screen where there is no post.
Contributor
Preview changesI've detected changes to the following themes in this PR: Varia. I will update this comment with the latest preview links as you push more changes to this PR. Note The preview sites are created using WordPress Playground. You can add content, edit settings, and test the themes as you would on a real site, but please note that changes are not saved between sessions. |
Contributor
Theme-Check resultsvaria: There are required changes on the theme ❌.❎ REQUIRED
💡 RECOMMENDED (6)
|
$post before adding admin body classes$post on widgets screen before adding admin body classes
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Changes proposed in this Pull Request:
Check for
$postbefore adding admin body classes. This prevents a PHP warning on the widgets screen where there is no post.The error also causes a UI anomaly in the admin sidebar:
Testing:
Note, the PHP warning does not appear in production, probably because these warnings are suppressed.
Activate Varia or a Varia child theme like Rockfield.
Sandbox a test site and navigate to /wp-admin/widgets.php
The above error should not show and the nav should appear normal.
Related issue(s):