How to remove a class from post_class() – WordPress

If you want to remove any class from the post_class() function paste the following snippet into your functions.php file.

In this example I'm removing the "hentry" class.

add_filter( 'post_class', 'remove_hentry_function', 20 );
function remove_hentry_function( $classes ) {
	if( ( $key = array_search( 'hentry', $classes ) ) !== false )
		unset( $classes[$key] );
	return $classes;
}

About Ricard Torres

Senior Front-end Software Engineer from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

@ricard_dev @ricard_dev

📝 Blog 🎙 Podcast

3 comments

Leave a Reply

Add <code> Some Code </code> by using this tags.

*
*