Skip to content

Conversation

@brandonpayton
Copy link
Member

Description

The get_current_screen function is documented to not always be defined even when is_admin returns true. We've encountered a case like this with Gutenberg on WordPress.com where is_gutenberg_page incorrectly assumes get_current_screen exists.

Let's update is_gutenberg_page to check if get_current_screen exists.

How has this been tested?

  • Added a filter for ms_site_check that triggers wp_enqueue_scripts before exiting and encountered the Call to undefined function get_current_screen() fatal.
  • Added this check and no longer experienced a fatal.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@brandonpayton brandonpayton added the Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts label Nov 10, 2018
@brandonpayton brandonpayton added this to the 4.4 milestone Nov 10, 2018
@brandonpayton brandonpayton self-assigned this Nov 10, 2018
@brandonpayton brandonpayton requested a review from mkaz November 10, 2018 18:47
@brandonpayton brandonpayton added the [Type] Bug An existing feature does not function as intended label Nov 10, 2018
Copy link
Member

@mkaz mkaz left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@swissspidy swissspidy merged commit 5238c11 into master Nov 12, 2018
@swissspidy swissspidy deleted the fix/missing-get-current-screen branch November 12, 2018 07:50
@brandonpayton brandonpayton restored the fix/missing-get-current-screen branch November 12, 2018 21:10
@brandonpayton brandonpayton deleted the fix/missing-get-current-screen branch November 12, 2018 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants