Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
add a body class based on query string
function string_body_class($classes) {
if ( isset($_GET) && isset( $_GET['class'] ) ) :
$classes[] = sanitize_html_class( $_GET['class'] );
return $classes;
add_filter('body_class', 'string_body_class');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment