How to remove the Theme Customization Button from the dashboard and themes options page?

In my WordPress theme that I’ve currently been building I do not take advantage of the WordPress Theme Customization API. As much as I would like too, I’ve invested far too much time into my own personal theme options framework for changing things.

This leads me to my question. How do I remove the blue, “Customize Your Site” button from the dashboard as well as link shown when viewing Appearance > Themes? I did some Googling, but my Google-Fu failed and couldn’t find a solution that didn’t use CSS or Javascript.

Read More

Ideally a hook to remove it would be best. But if there is no clean way to do so, a JS and or CSS solution would be fine.

Related posts

Leave a Reply

5 comments

  1. With the lastest version of WordPress (4.3) you can now natively remove the customizer’s theme switch setting without resorting to CSS hacks.

    /**
     * Remove customizer options.
     *
     * @since 1.0.0
     * @param object $wp_customize
     */
    function ja_remove_customizer_options( $wp_customize ) {
       //$wp_customize->remove_section( 'static_front_page' );
       //$wp_customize->remove_section( 'title_tagline'     );
       //$wp_customize->remove_section( 'nav'               );
       $wp_customize->remove_section( 'themes'              );
    }
    add_action( 'customize_register', 'ja_remove_customizer_options', 30 );
    
  2. In the latest version of WordPress, the themes section is a panel, so it must be removed as follows:

    add_action( 'customize_register', 'prefix_remove_customizer_options', 30 );
    /**
     * Remove customizer options.
     *
     * @since 1.0.0
     * @param object $wp_customize The current WordPress customizer object.
     */
    function prefix_remove_customizer_options( $wp_customize ) {
        $wp_customize->remove_panel( 'themes' );
    }
    
  3. This will fully remove the menu option:

    add_action('admin_menu', function () {
        global $submenu;
    
        foreach ($submenu as $name => $items) {
            if ($name === 'themes.php') {
                foreach ($items as $i => $data) {
                    if (in_array('customize', $data, true)) {
                        unset($submenu[$name][$i]);
    
                        return;
                    }
                }
            }
        }
    });
    

    Other answers don’t remove it if you are on another subpage + you hover themes menu (you’ll see it in submenus)

  4. There are no hooks to that part of the Dashboard.

    It has to be done with CSS (or jQuery if you want to convert it in another thing).

    add_action( 'admin_head-index.php', 'hide_customize_button_wpse_82424' );
    
    function hide_customize_button_wpse_82424(){
        ?>
        <style type="text/css">div.welcome-panel-column:first-child {display:none;} </style>
        <?php
    }
    

    [update]

    As pointed by @helenhousandi in a comment:

    the wp_welcome_panel() function is added on the welcome_panel hook, but no, there are (purposefully) no hooks inside that function.

    So, another approach is to remove the action hook and recreate the wp_welcome_panel() function, like so:

    add_action( 'load-index.php', 'remove_welcome_panel' );
    function remove_welcome_panel()
    {
        remove_action( 'welcome_panel', 'wp_welcome_panel' );
        add_action( 'welcome_panel', 'my_welcome_panel' );
    }
    

    And my_welcome_panel is a replica of wp_welcome_panel() adapted as one wishes.

    Please, also note her observation: my emphasis

    I would suggest against having a publicly distributed theme remove it, though, because a user may come to expect that it’s there. We found in user testing that many new users returned to that welcome panel even after getting acquainted.

  5. You need to Pass the following code at function.php

    function theme_option_remove( $wp_customize ) {
    $wp_customize->remove_section("themes");
    }
    add_action( 'customize_register', 'theme_option_remove' ,20 );