Enhancements: Use theme supports for disabling Font Library#79027
Open
Mustafabharmal wants to merge 1 commit into
Open
Enhancements: Use theme supports for disabling Font Library#79027Mustafabharmal wants to merge 1 commit into
Mustafabharmal wants to merge 1 commit into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
What?
Closes #79019
Introduce a
font-librarytheme support that provides a single mechanism for enabling or disabling the Font Library across both the Block Editor and the WP Admin interface.When the Font Library is disabled using
remove_theme_support( 'font-library' ), the Font Library UI is no longer available in the editor and the Fonts admin screen is removed and cannot be accessed directly.Why?
Prior to this change, developers could disable the Font Library in the editor by setting
fontLibraryEnabledtofalsevia theblock_editor_settings_allfilter.However, after the introduction of the dedicated Fonts admin screen, this approach no longer fully disabled the feature. The editor UI could be hidden while the Fonts screen under Appearance remained accessible through both the menu and direct URLs.
This creates an inconsistent experience and requires developers to implement multiple custom solutions to fully disable the feature.
Providing a dedicated
font-librarytheme support aligns with existing WordPress patterns and offers a single, centralized way to control Font Library availability.How?
This PR introduces a new
font-librarytheme support and uses it as the source of truth for Font Library availability.Font Library Admin Screen
Core's Fonts submenu registration is removed to avoid duplicate menu items.
The Gutenberg Fonts screen is only registered when the active theme supports
font-library.When the feature is disabled, direct access to:
themes.php?page=font-library.phpthemes.php?page=font-library-wp-adminis blocked and returns an error response.
Block Editor Settings
gutenberg_get_block_editor_settings()now derivesfontLibraryEnabledfromcurrent_theme_supports( 'font-library' ).block_editor_settings_allcontinue to work because they can still override the setting through the existing filter.Testing Instructions
Default Behavior
Disable the Font Library
Direct URL Access
Verify access is denied.
Visit:
Backward Compatibility
Screenshots or screencast