• I have changed the theme.json so that custom colors are only accessible to admins. Unfortunately, the GenerateBlocks blocks don’t seem to use the default WordPress color picker? It works for all other blocks. How can I limit the GenerateBlocks color picker too?

    function bw_change_theme_json_settings( WP_Theme_JSON_Data $theme_json ): WP_Theme_JSON_Data {

    // New settings
    $new_data = array(
    'version' => 3,
    'settings' => array(
    'color' => array(
    'custom' => current_user_can( 'manage_options' ),
    'customDuotone' => current_user_can( 'manage_options' ),
    'customGradient' => current_user_can( 'manage_options' ),
    ),
    ),
    );

    // Merge and return settings
    return $theme_json->update_with( $new_data );
    }

    add_filter( 'wp_theme_json_data_user', 'bw_change_theme_json_settings', 100 );

    Thanks,
    Manja

Viewing 1 replies (of 1 total)
  • Plugin Support David

    (@diggeddy)

    Hi there,

    I am not sure we have a filter for that; I am going to check with the devs.

    You may have to resort to some CSS to hide the color picker and input field in the admin. This CSS should do it:

    .gblocks-color-component-content :is(.react-colorful, .gblocks-color-component-content__input-wrapper) {
    display: none;
    }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.