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?
This PR adds theme support for the link color settings.
Update: This core patch has been committed https://core.trac.wordpress.org/ticket/58597
Closes #41857, replaces #47675
Alternative to #47451
Related:
Core ticket and patch https://core.trac.wordpress.org/ticket/58597
core 57460 Backport: appearance-tools theme_support
core 56487 Bundled themes: opt-in to appearance tools
Why?
There is no way for themes to enable link color settings without theme.json (Theme.json can not be added to all classic themes without friction).
How?
Adds a conditional check, and if the theme or plugin adds
add_theme_support( 'link-color' );
enables the setting in the block editor.Testing Instructions
In your WordPress install, make sure that WP_DEBUG_DISPLAY, WP_DEBUG are set to true.
Activate Twenty Twenty-One.
You should see a doing it wrong message about experimental-link-color.
In your code editor, open functions.php in Twenty Twenty-One.
Around line 333, remove
add_theme_support( 'experimental-link-color' );
And add:
On refresh, the doing it wrong notice should no longer show.
Create a new post.
Add a link to a paragraph block.
Confirm that the paragraph has a link color setting. Select a custom link color and confirm that it works.
Palette colors will not work on the front, that is a separate issue:
There are known bugs in Twenty Twenty-One that needs to be solved, you do not need to test them as part of this PR,
the main goal is to confirm that the controls are available.
Screenshots or screencast