Skip to content

Instantly share code, notes, and snippets.

@2aces
Created September 18, 2017 20:28
Show Gist options
  • Save 2aces/9cba9e2d47444301d9fa2eb032a8cb29 to your computer and use it in GitHub Desktop.
Save 2aces/9cba9e2d47444301d9fa2eb032a8cb29 to your computer and use it in GitHub Desktop.
WordPress: remove custom CSS created by Customizer
// first check if we are not in Admin area
if( !is_admin ){
// check if we are in an archive
if( is_archive() ){
//remove wp_custom_css_cb from the actions queue on wp_head using the same priority, 101
remove_action('wp_head', 'wp_custom_css_cb', 101);
}
}
// first check if we are not in Admin area
if( !is_admin ){
// get post global variable
global $post;
// check if post_id is equals to the post/page/custom_post ID we want to filter the CSS
if( $post->post_id === 10){
//remove wp_custom_css_cb from the actions queue on wp_head using the same priority, 101
remove_action('wp_head', 'wp_custom_css_cb', 101);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment