Removing the Tagline from the Theme Customizer in WordPress

I've finally started setting up the Theme Customizer in WordPress for my clients. I ran into an issue where the Theme Customizer has certain defaults that not all themes use. It is pretty rare for my sites to include a tagline; for us at BR the brand's tagline is usually included in the logo so we don't need to restate it. It would be very confusing if your theme customizer has an editable tagline that doesn't appear anywhere on the site.

Since this feature only came out this year there is still a lot of bad information running around; yes there is even some misinformation on WordPress Answers. The correct way to remove an entire section is this:


// remove section
$wp_customize->remove_section( 'section_id');

view raw

functions.php

hosted with ❤ by GitHub

You have to know the section ID that you're removing. You can dig through the HTML on the theme customizer page or you can look at this handy dandy list of the default theme customizer sections.

Removing a control within in section (such as removing a tagline within the Site Title & Tagline section) can be done in exactly the same way.


// remove control
$wp_customize->remove_control('control_id');

view raw

functions.php

hosted with ❤ by GitHub

As with removing the section above you have to know the ID of the control that you're removing. The easiest way to find a control is to dig through the HTML. Or if you're simply looking to remove the tagline the id is blogdescription.

So you figured out how to remove the tagline from the theme customizer, all done right? Well I thought I was till I looked at the theme customizer and noticed that there is now a section called “Site Title & Tagline” and it only controls the site title with a tagline no where to be seen. Facepalm. Alright – just a little bit further – we just have to rename the section. We can actually just redeclare it with a new name.


// rename existing sections
$wp_customize->add_section( 'section_id' , array(
'title' => __('Section Title','mytheme'),
'priority' => 20,
));

view raw

functions.php

hosted with ❤ by GitHub

The complete code to remove the tagline from the theme customizer and rename the section looks like this:


// remove control
$wp_customize->remove_control('blogdescription');
// rename existing section
$wp_customize->add_section( 'title_tagline' , array(
'title' => __('Site Title','mytheme'),
'priority' => 20,
));

view raw

functions.php

hosted with ❤ by GitHub

4 thoughts on “Removing the Tagline from the Theme Customizer in WordPress

  1. Exactly just what I needed for my theme. Thanks. 🙂

  2. No need to redeclare. Use the following:

    $wp_customize->get_section('title_tagline')->title = __('Site Title');

  3. Thanks for this – I couldn’t easily find this information in the WordPress codex. I wish they would improve the way they show and organise their documentation as it would make things a lot easier!

    This solved our issue – thanks!

    Ben

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.