Skip to content

Instantly share code, notes, and snippets.

@nameDark
Last active July 12, 2019 11:32
Show Gist options
  • Save nameDark/e12a324cebe89829171f298ccd936c00 to your computer and use it in GitHub Desktop.
Save nameDark/e12a324cebe89829171f298ccd936c00 to your computer and use it in GitHub Desktop.
SEO. Remove attr text/javascript, text/css, hentry class
add_filter('style_loader_tag', 'dark_theme_remove_type_attr', 10, 2);
add_filter('script_loader_tag', 'dark_theme_remove_type_attr', 10, 2);
function dark_theme_remove_type_attr($tag, $handle) {
$tag = str_replace( 'type="text/javascript"', '', $tag);
$tag = str_replace( "type='text/javascript'", '', $tag);
$tag = str_replace( 'type="text/css"', '', $tag);
$tag = str_replace( "type='text/css'", '', $tag);
return $tag;
}
add_filter('post_class', 'wph_remove_hentry_class');
function wph_remove_hentry_class($classes) {
$classes = array_diff($classes, array('hentry'));
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment