yanknudtskov
12/11/2016 - 3:01 PM

Remove the customizer CSS option

Remove the customizer CSS option

<?php

add_action( 'customize_register', 'jt_customize_register' );

function jt_customize_register( $wp_customize ) {
    $wp_customize->remove_control( 'custom_css' ); // Remove ability
    $wp_customize->remove_section( 'custom_css' ); // Remove entirely
}

// Option for removing the CSS capability while maintaining ability to add unfiltered HTML
add_filter( 'map_meta_cap', 'jt_map_meta_cap', 10, 3 );
function jt_map_meta_cap( $caps, $cap, $user_id ) {
    if ( 'edit_css' === $cap ) {
        $caps = array( 'do_not_allow' );
    }
    return $caps;
}