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

Avoid calling missing get_current_screen function #11721

merged 1 commit into from Nov 12, 2018


None yet
3 participants

brandonpayton commented Nov 10, 2018


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 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.


  • 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 this to the 4.4 milestone Nov 10, 2018

@brandonpayton brandonpayton self-assigned this Nov 10, 2018

@brandonpayton brandonpayton requested a review from mkaz Nov 10, 2018


mkaz approved these changes Nov 12, 2018

Looks good 👍

@swissspidy swissspidy merged commit 5238c11 into master Nov 12, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

@swissspidy swissspidy deleted the fix/missing-get-current-screen branch Nov 12, 2018

@brandonpayton brandonpayton restored the fix/missing-get-current-screen branch Nov 12, 2018

@brandonpayton brandonpayton deleted the fix/missing-get-current-screen branch Nov 12, 2018

grey-rsi pushed a commit to OnTheGoSystems/gutenberg that referenced this pull request Nov 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment