0

Below is the function to add my custom colors, the 'disable-custom-colors' is working properly, but the custom colors that I'm trying to add are not appearing in the editor. I have also tried clearing my cache and the issue persists.

function add_custom_gutenberg_color_palette() {
    add_theme_support( 'disable-custom-colors' );

    add_theme_support(
        'editor-color-palette',
        array(
            array(
                'name'  => esc_html__('Red', 'twentytwentyone-child'),
                'slug'  => 'red',
                'color' => '#E4D1D1',
            ),
            array(
                'name'  => esc_html__('Orange', 'twentytwentyone-child'),
                'slug'  => 'orange',
                'color' => '#E4DAD1',
            )
        )
    );
}
add_action( 'after_setup_theme', 'add_custom_gutenberg_color_palette' );

Thank you for the help!

1 Answer 1

2

I noticed that you're using a child theme of Twenty Twenty-One, which also registers custom editor color palette using the same hook and priority (i.e. 10), so try using 11 or greater as the action's priority:

add_action( 'after_setup_theme', 'add_custom_gutenberg_color_palette', 11 );
1
  • 1
    Yes that was it! Thank you!
    – BeccaN
    Mar 30, 2022 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.