Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix undefined variable warning in gutenberg.php #12053

Merged
merged 2 commits into from
Nov 19, 2018

Conversation

earnjam
Copy link
Contributor

@earnjam earnjam commented Nov 19, 2018

Introduced an undefined global $post variable in 095d18f.

Quick fix for that.

closes #12061

@gziolo gziolo requested a review from a team November 19, 2018 11:34
@gziolo gziolo added [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended labels Nov 19, 2018
@gziolo gziolo added this to the 4.5 milestone Nov 19, 2018
gutenberg.php Outdated
@@ -67,6 +67,7 @@ function the_gutenberg_project() {
* @since 0.1.0
*/
function gutenberg_menu() {
global $post;
if ( ! gutenberg_can_edit_post( $post ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it doesn't make sense to keep the check actually because this menu is always rendered in the admin and not only when there's a global $post variable (post being edited).

I think the reasoning for the PR was to hide the menu if the rich-text preference is disabled But I don't think it's very important to check for it anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

I pushed a commit to remove the check entirely.

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@gziolo gziolo requested a review from mkaz November 19, 2018 12:02
@youknowriad youknowriad force-pushed the fix/undefined-global-post branch from 47c0672 to 6ad33c1 Compare November 19, 2018 13:34
@youknowriad youknowriad merged commit 2aea727 into master Nov 19, 2018
@youknowriad youknowriad deleted the fix/undefined-global-post branch November 19, 2018 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

$post not defined in gutenberg_menu()
3 participants