Support » Requests and Feedback » Feature request one line of code to disable all customizer stuff

  • Shmoo

    (@macpresss)


    Not a happy about this, because this is very ugly and totally not WordPress.

    All those code-snippets are needed to remove, hide or prevent access to the WP Theme Customizer when a Theme doesn’t support it.
    If my theme has no styles or actions attached to it you keep getting an useless empty framework front-end.

    /***
    	* All code below prevents access or hides the WordPress Customizer ( Front-end Editor ) Needed? see,
    	* https://codex.wordpress.org/Theme_Customization_API
    ***/
    function shmoo_customize() {
    	// Disallow acces to an empty editor
    	wp_die( sprintf( __( 'No WordPress Theme Customizer support - If needed check your functions.php' ) ) . sprintf( '<br /><a href="javascript:history.go(-1);">Go back</a>' ) );
    }
    add_action( 'load-customize.php', 'shmoo_customize' );
    
    // Remove 'Customize' from Admin menu
    function remove_submenus() {
    	global $submenu;
    	// Appearance Menu
    	unset($submenu['themes.php'][6]); // Customize
    }
    add_action('admin_menu', 'remove_submenus');
    
    // Remove 'Customize' from the Toolbar -front-end
    function remove_admin_bar_links() {
        global $wp_admin_bar;
        $wp_admin_bar->remove_menu('customize');
    }
    add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' );
    
    // Add Custom CSS to Back-end head
    function shmoo_admin_css() {
    	echo '<style type="text/css">#customize-current-theme-link { display:none; } </style>';
    }
    add_action('admin_head', 'shmoo_admin_css');

    It would be nice if we had one line of code to register this Customizer or one line of code to disable everything at once.

Viewing 1 replies (of 1 total)
  • Agreed!

    One line would be great. This was done with disabling the front-end admin bar, why not the Customizer? It can be really confusing for clients to have BOTH a “Theme Options” link and the “Customize” link. And hiding it via display:none just seems wrong.

Viewing 1 replies (of 1 total)
  • The topic ‘Feature request one line of code to disable all customizer stuff’ is closed to new replies.