Created
May 22, 2019 00:35
-
-
Save techmuzz/3aea126fbbbc9d9108ea9b2bfe47babe to your computer and use it in GitHub Desktop.
Remove Any Class From WordPress Body And Post Classes - https://www.techmuzz.com/how-to/wordpress/remove-any-class-from-wordpress-body-and-post-classes/
This file contains hidden or 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
function remove_archive_body_class( $classes ) { | |
if ( is_archive() ) { | |
foreach ( $classes as $key => $value ) { | |
if ( $value == 'archive' ) unset( $classes[$key] ); | |
} | |
} | |
return $classes; | |
} | |
add_filter( 'body_class', 'remove_archive_body_class', 20, 2 ); |
This file contains hidden or 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
function remove_CLASS_NAME_body_class ( $wp_classes ) { | |
foreach ( $wp_classes as $key => $value ) { | |
if ( $value == 'CLASS_NAME' ) unset( $wp_classes[$key] ); | |
} | |
return $wp_classes; | |
} | |
add_filter( 'body_class', 'remove_CLASS_NAME_body_class', 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment