14

My theme doesn't use the tag line, how can I remove it from the customizer?

17

Late to the party but this will do the trick:

$wp_customize->remove_control('blogdescription');

You want to remove just that control, not entire section as suggested above.

  • 1
    The setting should also be removed: $wp_customize->remove_setting('blogdescription') – mimarcel Nov 12 '18 at 20:57
  • Will this also remove any stored value that's currently in there? I'm having an issue where I want to delete existing setting/controls that have existing data, but the data is still being called back. wordpress.stackexchange.com/questions/329343/… – Lee Feb 20 at 11:35
9

Remove a pre exising customizer setting in wordpress theme with this code.

enter image description here

add_action( "customize_register", "ruth_sherman_theme_customize_register" );
function ruth_sherman_theme_customize_register( $wp_customize ) {

 //=============================================================
 // Remove header image and widgets option from theme customizer
 //=============================================================
 $wp_customize->remove_control("header_image");
 $wp_customize->remove_panel("widgets");

 //=============================================================
 // Remove Colors, Background image, and Static front page 
 // option from theme customizer     
 //=============================================================
 $wp_customize->remove_section("colors");
 $wp_customize->remove_section("background_image");
 $wp_customize->remove_section("static_front_page");

}
6

I found out the WP_Customize_Manager class has a function called remove_section(). In your function hooked to customize_register you can just do:

    $wp_customize->remove_section('nav');
    $wp_customize->remove_section('static_front_page');

You can find the ID of the section (i.e. 'nav') if you inspect the accordion title bar of the section. Look at the ID of the containing <li> tag and it's the portion of the string after "customize-section-". I.E.:

<li id="customize-section-static_front_page" class="control-section customize-section">

-- the ID is "static_front_page"

  • That looks better than my solution so I will give you the tick - I haven't tested it but I suppose you have ... I don't get the title_tagline though - surely it should say static_front_page, is that a typo BAC? – byronyasgur Aug 24 '12 at 1:29
  • @byronyasgur yep, that was a copy pasta error, fixed now. Thanks! – jessica Aug 24 '12 at 1:32
  • Actually, this isn't the correct answer. This removes the entire section that contains both the site title & tagline. The question is asking for only the tagline. Look at the answer below by @byronyasgur – BFTrick Nov 15 '12 at 1:13
2

Accoring to OTTO

One final thing you can add to a section is a “theme_supports” option. This will make the menu not appear unless the theme supports something. If you’re putting this code in a theme itself, then you already know what the theme supports, so it doesn’t make much sense. The core uses this to not show the header and background options if the theme doesn’t support them.

So I put that together with

    $wp_customize->get_setting('blogdescription')->transport='postMessage';

... and discovered that the following code worked. I put false in for the theme_supports ... not sure what I really should be putting in ... maybe someone a bit more expert can improve on this.

    $wp_customize->add_control('blogdescription')->theme_supports=false;
0

If you are using this in a plugin you should use priority argument like 999 and it will work in the plugin.

add_action( "customize_register","wpcb_theme_customize_register",999,1);    

function wpcb_theme_customize_register($wp_customize){
   $wp_customize->get_setting('blogdescription')->transport='postMessage';
}
0

if the section / panel or control core , it is always better to disable them in place of removing.

add_action( "customize_register","wp_stackexchange_58932");
function wp_stackexchange_58932(){
    $wp_customize->get_section( 'static_front_page' )->active_callback = '__return_false';
    $wp_customize->get_section( 'custom_css' )->active_callback = '__return_false';
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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