Hanya tambahan jawaban @ Geert (menambahkan daftar hitam juga) :)
Harap sangat baik untuk menandai jawaban @ Geert sebagai solusi (bukan yang ini).
function wpse15850_body_class( $wp_classes, $extra_classes )
{
// List of the only WP generated classes allowed
$whitelist = array( 'home', 'blog', 'archive', 'single', 'category', 'tag', 'error404', 'logged-in', 'admin-bar' );
// List of the only WP generated classes that are not allowed
$blacklist = array( 'home', 'blog', 'archive', 'single', 'category', 'tag', 'error404', 'logged-in', 'admin-bar' );
// Filter the body classes
// Whitelist result: (comment if you want to blacklist classes)
$wp_classes = array_intersect( $wp_classes, $whitelist );
// Blacklist result: (uncomment if you want to blacklist classes)
# $wp_classes = array_diff( $wp_classes, $blacklist );
// Add the extra classes back untouched
return array_merge( $wp_classes, (array) $extra_classes );
}
add_filter( 'body_class', 'wpse15850_body_class', 10, 2 );