Fixing WordPress theme hentry schema and classes

WordPress is a popular content management system that is used by millions of websites around the world. One of the many features of WordPress is the ability to add schema markup to your content, which can improve its visibility in search engine results. However, some WordPress themes can cause issues with the “hentry” schema and classes. This article will discuss how to fix these issues and ensure that your WordPress website is fully optimized for search engines.

How to fix “hentry” schema and class issues in WordPress themes

To make things easier, I’ve created a table of contents to help you navigate my “Fixing WordPress theme hentry schema and classes.”

What is the “hentry” schema and class?

“Hentry” schema is a type of microdata markup from the schema.org vocabulary used to describe blog posts, news articles, and other similar types of content on websites. The “hentry” schema provides a structured way of marking up content, which can help search engines understand the content better and improve the visibility of the content in search results.

The “hentry” schema includes properties such as “entry-title,” “published,” “author,” and “updated,” which provide information about the title, date, author, and last updated time of the content. These properties can be used to create rich snippets in search engine results, which can help users better understand the content before clicking through to the website.

How to fix hentry schema and class issues in WordPress themes
How to fix hentry schema and class issues in WordPress themes

To use the “hentry” schema, you need to add the appropriate microdata markup to the HTML code of your website. Many tools and plugins can help you add the “hentry” schema markup to your website without needing to know HTML. Using “hentry” schema markup, you can improve your website’s content’s visibility and search engine ranking.

The “hentry” class is a class attribute that is added to the HTML code of your website. WordPress themes use it to provide additional styling and functionality to your content.

However, this post is about an “hentry” schema and classes that automatically added the “hentry” class to the HTML markup of the WordPress theme. The Schema tester found “hentry” schemas even though the website did not use the “hentry” schema markup, resulting in errors and warnings in the Google Search Console. These issues can affect the visibility of your content in search engine results, which can have a negative impact on your website’s traffic and rankings.

Google Search Console without hentry issue
Google Search Console without hentry issue

How to fix “hentry” schema and class issues in WordPress themes

Add the code to remove the hentry classes using the functions.php file.
Add the code to remove the hentry classes using the functions.php file.

Here are some steps you can take to fix “hentry” schema and class issues in WordPress themes:

Check your theme settings

Some WordPress themes have a setting to enable or disable “hentry” schema markup. Check if your theme has such a setting and ensure it is enabled.

Theme Customizer
Theme Customizer

Check your plugin settings

If you are using a plugin to add schema markup to your website, check the plugin settings to see if the hentry” schema markup is disabled. If it is enabled, disabled it and test your website to see if the issue has been resolved.

Remove conflicting plugins or code

Conflicts can arise when multiple plugins or code snippets add schema markup to your website. Try disabling any other plugins that may be adding schema markup and see if the issue is resolved. You can also try removing any code snippets that may be causing the conflict.

hentry class
hentry class on WordPress HTML markup

Edit the HTML class attribute (functions.php file) – My solution

If WordPress is automatically adding the “hentry” class to the HTML class attribute, you can try manually removing it from the class attribute in your theme’s code or you can use the code below to add it to your functions.php file. The code below removes the “hentry” class from the HTML markup of the WordPress website.

is_front_page() – If you designate a static page as your site’s front page, this function will return true when you view that page.

function aljunmajo_remove_class_hentry( $hentry_class ) {

  // run only if it is in HOME page 
  // else use this is_page() run any single Page
	if ( is_front_page() ) {
		$hentry_class = array_diff( $hentry_class, array( 'hentry' ) );
  	}
	return $hentry_class;
}
add_filter( 'post_class','aljunmajo_remove_class_hentry' );

Test your website

After making any changes, test your website using Google’s Structured Data Testing Tool to ensure that the “hentry” schema markup is correctly applied and there are no errors.

Make use of this schema testing tool https://validator.schema.org/

There is no structured data for hentry
There is no structured data for hentry

Final Thoughts: “hentry” schema and classes

By following these steps, you can identify and resolve any issues with the “hentry” schema markup and ensure that your structured data is correct and compliant with Google’s guidelines.

Let’s say you know how to code in HTML and PHP for WordPress or have worked as a Web Developer before. In that case, you can easily add this feature to your website by fixing the “hentry” schema and classes for your WordPress theme. But let’s say you have difficulty getting this “hentry” schema issue into place. In that case, you can buy me a coffee and ask me to fix the “hentry” schema problem on your WordPress site, as shown above.

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA