Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Hi,

    I just tried this code out on my development site, and it works fine.

    The only thing I can think of may seem a bit obvious, but remember to uncomment the lines containing the modules you wish to disable.

    Thread Starter wiredpinecone

    (@wiredpinecone)

    Hi Shea,

    Thanks for your reply – in the meantime, I figured it out: the feature I was trying to disable (site icon) has now become a part of WordPress core and is no longer in Jetpack.

    However, the code which should be working to accomplish that is still not working – any ideas would be helpful:

    add_action( “customize_register”, “l_c_theme_customize_register” );
    function l_c_theme_customize_register( $wp_customize ) {

    //=============================================================
    // Remove site icon and even title/tagline – which is also configured in Settings – in the “Site Identity” area from theme customizer
    //=============================================================
    $wp_customize->remove_setting(“site_icon”);
    $wp_customize->remove_control(“WP_Customize_Site_Icon_Control”);
    $wp_customize->add_section(“title_tagline”)->theme_supports=false;
    $wp_customize->remove_control(“title_tagline”);
    $wp_customize->add_control(‘WP_Customize_Site_Icon_Control’)->theme_supports=false;
    }

    Plugin Author Shea Bunge

    (@bungeshea)

    The issue with that snippet appears to be it’s hooked too early. You’re trying to remove things which haven’t been added yet. I’ve written a few snippets which you can use instead.

    To remove the “Site Identity” panel completely:

    add_action( 'customize_register', function ( $wp_customize ) {
    	$wp_customize->remove_section( 'title_tagline' );
    }, 99 );

    To remove just the title/tagline and site icon controls, but keep the Site Identity panel:

    add_action( 'customize_register', function ( $wp_customize ) {
    	// Remove the Site Title text input
    	$wp_customize->remove_control( 'blogname' );
    
    	// Remove the Tagline text input
    	$wp_customize->remove_control( 'blogdescription' );
    
    	// Remove the Site Icon image upload
    	$wp_customize->remove_control( 'site_icon' );
    
    	// Remove the Display Site Title and Tagline checkbox
    	$wp_customize->remove_control( 'header_text' );
    	$wp_customize->remove_control( 'display_header_text' );
    }, 99 );
    Thread Starter wiredpinecone

    (@wiredpinecone)

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Snippet to disable jetpack module not working’ is closed to new replies.