-
-
Save bmoredrew/4120398 to your computer and use it in GitHub Desktop.
Remove unnecessary markup from WooCommerce
This file contains 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
<?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