fix: blank snippets page when another plugin's screen_settings filter returns null - #481
Merged
Conversation
Manage_Menu_Screen_Options::render() declared its parameter as string. Any other plugin or theme filtering screen_settings that forgets to return its value hands the next callback null, which raised a TypeError. The filter runs while WordPress renders the screen meta, so the fatal lands after the admin chrome but before any content: the snippets page looks blank while the rest of the admin appears healthy. Accept the value loosely and coerce a non-string to an empty string, so a careless callback elsewhere degrades to an empty Screen Options panel instead of taking the page down.
TallblokeUK
force-pushed
the
fix/screen-settings-type/core
branch
from
August 28, 2026 07:58
b564e75 to
7e13dcb
Compare
Contributor
Download and install |
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.
Fixes the fatal behind the "blank All Snippets page" reports — #671 and #674 — reproduced locally from a customer's WordPress fatal-error email.
The bug
Manage_Menu_Screen_Options::render()declared its parameter asstring:It is hooked to
screen_settings, a shared WordPress filter. Any other plugin or theme that filters it and forgets to return its value hands the next callbacknull, and on PHP 8 that is a fatal:We are not the plugin at fault, but we are the one that dies.
Why it looks like a blank page rather than an error
The filter runs while WordPress renders the screen meta — after the admin header, before the page content. So the response is a 200 with a fully working admin menu and no content at all:
Local Snippets: All SnippetsThat is why the reports describe a healthy-looking admin with an empty Snippets screen, and why nothing obvious shows up in the browser console.
The fix
Accept the value loosely and coerce it. A careless callback elsewhere now degrades to an empty Screen Options panel instead of taking the page down.
Testing
Two regression tests. Both fail on
corewith the customer's exact error at the same line; the second goes through the realapply_filters→class-wp-hook.phppath rather than calling the method directly.test_render_tolerates_a_null_value_from_an_earlier_callbacktest_screen_settings_filter_chain_survives_a_null_returning_callbackFull suite: 147 tests, 0 failures.
phpcsclean.Also verified end to end on a local WP 7.1 / PHP 8.3 site with an mu-plugin returning
nullfromscreen_settingsat priority 5 — the table renders again and the filter chain completes instead of stopping at our callback.Same hazard elsewhere — deliberately not in this PR
The sweep found three more strictly-typed filter callbacks. Left out to keep this patch-release diff tight, but worth a follow-up:
disable_snippet_execution( bool )code_snippets/execute_snippetsnullreturn here fatals the front end, not just adminadd_safe_mode_query_var( string )home_url,admin_urladd_settings_fields( array )code_snippets_settings_fieldsdisable_snippet_executionis arguably worse than the one fixed here — happy to fold it in or open it separately, whichever you prefer.