Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove hentry from post_class()
<?php
/**
* Remove 'hentry' from post_class()
*/
function ja_remove_hentry( $class ) {
$class = array_diff( $class, array( 'hentry' ) );
return $class;
}
add_filter( 'post_class', 'ja_remove_hentry' );
@andpiazza

This comment has been minimized.

Copy link

@andpiazza andpiazza commented Aug 20, 2018

Reason why this code does NOT work is: it removes hentries from posts, when in reality it needs to remove from pages, categories and tags.
If anything, removing hentries from posts might HURT your SEO results: hentries are designed to capture articles' meta data so that's exactly where you want it to show.

I posted here code that does removes hentries from pages categories and tags: https://github.com/andpiazza/remove_hentry_wordpress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment