Skip to content

Instantly share code, notes, and snippets.

@bmoredrew
Forked from retlehs/gist:4120053
Created November 20, 2012 19:24
Show Gist options
  • Save bmoredrew/4120398 to your computer and use it in GitHub Desktop.
Save bmoredrew/4120398 to your computer and use it in GitHub Desktop.
Remove unnecessary markup from WooCommerce
<?php
/**
* Remove unnecessary markup from WooCommerce:
*
* 1. Remove <meta name="generator" content="WooCommerce (version)" />
* 2. Remove the addition of <body class="theme-themename">
*/
function woocommerce_head_cleanup() {
global $woocommerce;
remove_action('wp_head', array($woocommerce, 'generator'));
}
add_action('woocommerce_init', 'woocommerce_head_cleanup');
function woocommerce_remove_theme_body_class($classes) {
$theme_name = wp_get_theme();
$theme_name = 'theme-' . sanitize_html_class(strtolower($theme_name));
$remove_classes = array($theme_name);
$classes = array_diff($classes, $remove_classes);
return $classes;
}
add_filter('body_class', 'woocommerce_remove_theme_body_class', 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment