You can configure the $whitelist
array in this function to filter out all other unwanted classes.
1 2 3 4 5 6 7 8 9 10 11 12 13 | add_filter( 'body_class', 'wpse15850_body_class', 10, 2 ); function wpse15850_body_class( $wp_classes, $extra_classes ) { // List of the only WP generated classes allowed $whitelist = array( 'portfolio', 'home', 'error404' ); // Filter the body classes $wp_classes = array_intersect( $wp_classes, $whitelist ); // Add the extra classes back untouched return array_merge( $wp_classes, (array) $extra_classes ); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.