Restrict "Default Post Format" Options to Formats Supported by the Active Theme #9059
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.
This PR updates the
options-writing.php
admin screen to ensure that the "Default Post Format" dropdown only displays post formats explicitly supported by the currently active theme. Previously, this dropdown listed all core post formats, regardless of whether the theme declared support viaadd_theme_support( 'post-formats', [...] )
.This behavior led to possible misconfiguration, user confusion, and inconsistent behavior between the settings screen and the post editor (which already hides unsupported formats).
Previous Logic
The dropdown was populated using:
This included all formats regardless of theme support.
New Logic
Replaced with:
This ensures only the intersection of supported formats and registered format strings is used. The
standard
format remains available separately, as it is treated as the fallback/default.Why This Matters
default_post_format
which have no effect on post rendering.Edge Cases Handled
standard
option is shown.Trac Link: https://core.trac.wordpress.org/ticket/43613