Created
August 13, 2015 21:13
-
-
Save priscillamc/185c872d6d4457186197 to your computer and use it in GitHub Desktop.
Remove WordPress Customizer links from the Admin Toolbar and dashboard by changing the body class back to 'no-customize-support'. This is a way to show only the original admin toolbar links for themes that don't support the Customizer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Remove customizer links from the Admin Toolbar and dashboard by changing the body class back to 'no-customize-support' | |
*/ | |
function pmc_remove_customize_support() { | |
// Copied from wp_customize_support_script() in wp-includes/theme.php | |
?> | |
<script type="text/javascript"> | |
(function() { | |
var b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)'); | |
b[c] = b[c].replace( rcs, ' ' ); | |
b[c] += 'no-customize-support'; | |
}()); | |
</script> | |
<?php | |
} | |
add_action( 'wp_before_admin_bar_render', 'pmc_remove_customize_support', 20 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment