Using Yoast SEO Structured Data with Genesis

The most recent update to Yoast SEO includes an incredibly powerful implementation of structured data, which is a tool search engines use to better understand your website. They also have extensive documentation for extending it.

But Genesis already includes structured data, also known as schema markup. If you’re using Genesis and Yoast SEO, it is best to disable Genesis schema to prevent search engine confusion and conflicting data.

If you don’t disable either Genesis or Yoast SEO schema, you’ll have duplicate schema on your page (screenshot).

Install the Plugin

If you don’t want to edit code in your Genesis theme, you can install my
Disable Genesis Schema plugin. Simply upload and activate!

View Plugin

Once you have Yoast SEO 11 installed, go to SEO > Search Appearance and set your schema to “Organization”, specify your Organization/Site name, and add an image. The image should be square, at least 112×112 (h/t Andrew Wilder). This will ensure the proper schema is output for article authors.

Before we get to the removal code, I’ll describe how Genesis and Yoast’s structured data are different.

How Genesis Schema works

Genesis uses an approach called microdata, which are data attributes attached to elements already on the page to describe those elements to search engines. For instance, your post title has itemprop="headline" to tell search engines that this is the headline of the current article.

You can run into issues if you remove elements from the page because you’re also removing the schema data that’s attached to those elements. For instance, if you remove the author name from the top of the post, you also lose the structured data saying you’re the author of this post.

You also end up with many unconnected blocks of schema. Here’s the results of the Structured Data Testing Tool on an article on my site before the code change:

How Yoast SEO Schema works

Yoast SEO uses JSON-LD which is a newer and better approach to structured data (more information).

JSON is a lightweight method to structure data to share with search engines and others. Rather than scattering your Schema data throughout the page and making the search engine assemble it (e.g. microdata), you prepare a small block of code that tells search engines exactly what they need to know in one place.

The -LD part stands for Linked Data, which means you’re able to link all of the individual schema components together. In the screenshot above you can see everything is a separate block with microdata, but with JSON-LD it would follow a hierarchical structure. The Article is part of a WebPage which is part of a WebSite.

Here’s my structured data after disabling Genesis schema and using the latest version of Yoast SEO:

Disable Genesis Schema

Install the Plugin

If you don’t want to edit code in your Genesis theme, you can install my
Disable Genesis Schema plugin. Simply upload and activate!

View Plugin

The code below will remove the schema markup from all the elements on the page.

I created a disable-genesis-schema.php file in my child theme and included it in my functions.php file (see here). There’s also a plugin version you can use instead of adding this code to your theme.

<?php
/**
* Disable Genesis Schema
*
* @package EAGenesisChild
* @author Bill Erickson
* @since 1.0.0
* @license GPL-2.0+
*/
add_action( 'init', 'be_disable_genesis_schema' );
/**
* Disable Genesis Schema
* @author Bill Erickson
* @see https://www.billerickson.net/yoast-schema-with-genesis/
*/
function be_disable_genesis_schema() {
$elements = array(
'head',
'body',
'site-header',
'site-title',
'site-description',
'breadcrumb',
'breadcrumb-link-wrap',
'breadcrumb-link-wrap-meta',
'breadcrumb-link',
'breadcrumb-link-text-wrap',
'search-form',
'search-form-meta',
'search-form-input',
'nav-primary',
'nav-secondary',
'nav-header',
'nav-link-wrap',
'nav-link',
'entry',
'entry-image',
'entry-image-widget',
'entry-image-grid-loop',
'entry-author',
'entry-author-link',
'entry-author-name',
'entry-time',
'entry-modified-time',
'entry-title',
'entry-content',
'comment',
'comment-author',
'comment-author-link',
'comment-time',
'comment-time-link',
'comment-content',
'author-box',
'sidebar-primary',
'sidebar-secondary',
'site-footer',
);
foreach( $elements as $element ) {
add_filter( 'genesis_attr_' . $element, 'be_remove_schema_attributes', 20 );
}
}
/**
* Remove schema attributes
*
*/
function be_remove_schema_attributes( $attr ) {
unset( $attr['itemprop'], $attr['itemtype'], $attr['itemscope'] );
return $attr;
}

Save some Genesis schema

Yoast only provides schema relating to the main content of the page (ex: Article), while Genesis provides schema for all elements of the page.

If you would like to include some of the Genesis schema for elements not covered by Yoast, you can use the be_remove_schema_elements filter to modify which elements are removed.

The code below (placed in your theme’s functions.php file) keeps the Genesis schema for the site header, navigation, sidebar, and footer.

Go here to see a list of all the schema elements being removed in my plugin, copy the elements you’d like to keep, and add them to the $save variable.

<?php
/**
* Save some Genesis schema
* @see https://billerickson.net
*
*/
function be_save_some_genesis_schema( $elements ) {
$save = array(
'site-header',
'site-title',
'site-description',
'nav-primary',
'nav-secondary',
'nav-header',
'nav-link-wrap',
'nav-link',
'sidebar-primary',
'sidebar-secondary',
'site-footer',
);
return array_diff( $elements, $save );
}
add_filter( 'be_remove_schema_elements', 'be_save_some_genesis_schema' );
view raw functions.php hosted with ❤ by GitHub

Disable Yoast SEO Schema

If you would prefer keeping Genesis’ schema data, you can disable Yoast SEO’s schema data using the following code in your theme’s functions.php file or the Code Snippets plugin:

add_filter( 'wpseo_json_ld_output', '__return_false' );

This is a good option if you’ve already made extensive customizations to the Genesis schema data on your site and aren’t ready to refactor that code to support Yoast’s structured data.

But if you’re like 99% of Genesis sites that haven’t modified the default schema, you’ll be better served switching over to Yoast SEO for schema data. I expect at some point Genesis will disable its own schema output if Yoast SEO is active, in the same way it removes its “Genesis SEO Settings” metabox if an SEO plugin is active. For now, you’ll have to manually disable it using the code provided above.

With the popularity of Yoast SEO, I expect more plugins to include support for schema through Yoast SEO. A recipe plugin could extend the article’s schema to include the recipe, rather than inserting their disconnected recipe schema directly into the page content.

I’m excited to see how this can be extended! If you have made any extensions to the schema (documentation here), please share it in the comments below.

Genesis Theme Framework WordPress Development Yoast SEO

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk

Reader Interactions

Comments

  1. App Shah says

    This is great article Bill. That’s one of the reason I haven’t upgraded to newer Yoast SEO version.

    I would wait for some more time before I disable Genesis Schema.

  2. CR says

    Thanks so much for this, Bill!
    Would you personally recommend going with Yoast as opposed to sticking with Genesis’ built in SEO capability? I was recently researching this and I didn’t come out with a perfectly clear option.
    (I hate having extra plugins but if it helps with SEO it’s probably worth it.)

    • Bill Erickson says

      The Genesis SEO metabox is fairly basic. It only lets you customize the title and description used in search results. But if that’s all you need from an SEO plugin then it works fine.

      Here are some of the features I like about Yoast SEO:
      – A visual preview of how the meta title and description will look in search results
      – Adds open graph tags so your content looks right when shared on Facebook and Twitter
      – Ability to specify alternate title, description, and image for social sharing
      – Ability to set a default social sharing image
      – Automatically builds XML Sitemap
      – More advanced breadcrumbs than the standard Genesis ones
      – More advanced schema than Genesis

  3. K says

    Hi – as a relative newbie, do all Genesis themes have this schema markup? I am using Essence Pro.
    How much slower would a webpage load using the Code Snippets Plugin for this (I’m not quite up to creating a child theme) and Yoast? I have personally preferred the cleaner look to the Genesis SEO than all of Yoast’s color/comments. Thanks!

    • Bill Erickson says

      Yes, all modern Genesis themes include schema. If you’re using an old XHTML theme from 5+ years ago you don’t have schema, but it’s unlikely you’re using a theme that old.

      I’m actually releasing this as a standalone plugin – just waiting for it to be approved by WordPress.org. Once it’s in there in the next few days, I’ll update the post and recommend installing that instead of the Code Snippets plugin.

      If you’d like to use the plugin right now, click here to download it, then go to Plugins > Add New, click “Upload” at the top, and upload the zip file you downloaded.

      • Elise says

        Thanks for the article, & for the plugin! Super useful 🙂

        This not quite on topic, but I think since this past Yoast update, the “Reply” text in my comments sections no longer work on all my sites with Genesis themes. Has this happened to anyone else?

        Any ideas for what I can do? Thanks so much in advance for any suggestions you can offer.

        • Bill Erickson says

          That’s strange. You might try contacting StudioPress support or Yoast support. I can’t think of a way Yoast would affect your Reply text.

  4. Marianne says

    Hi,
    Thanks for this. But the link to your plugin leads to Github and not to a plugin download page. Or am I missing something?

  5. Laurence Norah says

    Thanks very much for this Bill. Kind of crazy that Yoast would just steamroll this release out with minimal forewarning and zero settings for the end user – it’s not like Genesis is a niche theme, and I’m sure there are lots of other theme frameworks out there with their own scheme implementation.

    • Bill Erickson says

      I’m not sure but I think Genesis is the only popular theme that has some form of schema built-in. It’s really something that belongs in an SEO plugin since it’s an ever-changing SEO feature. The Genesis schema isn’t even accurate anymore – it marks all content as CreativeWork while blog posts should be Article and pages should be WebPage.

      WordPress SEO is the most popular SEO plugin, and the majority of users have no schema on their site at all. Including this by default leads to a positive improvement to a substantial portion of WordPress websites.

      It’s also necessary to ensure other plugins build their schema support on top of Yoast’s framework. If it were only an opt-in feature disabled by default, very few people would turn it on, and it wouldn’t be worth it for other plugins to build on their framework – they would keep outputting their own disconnected schema as everyone does currently.

      I do wish Yoast had reached out to Genesis, let them know this is coming, and recommended Genesis release an update that automatically disables Genesis schema if Yoast schema is present. I have just opened a ticket regarding this in the Genesis development area (GitHub), so we’ll see what happens.

      • Remkus says

        Thanks for the write up and kind words, Bill! But just to clarify, we did talk to the folks from StudioPress and explained this would come when we met at WordCamp US in December last year. It just turned out to be more complicated to get synched up together over the direction of our implementation, but we did try!

  6. Dawn says

    Hi Bill,

    I have Genesis breadcrumbs. So, all I have to do is update Yoast, install the plug in and that’s it? Thanks!

  7. Rob says

    Thanks for this Bill, appreciate it. Activated Yoast 11 on a few sites yesterday.

    Hey, I just ran the structured data tool to get a snapshot of what’s happening before I install this code snipped into my personal plugins file based off yours. I’m getting 3 errors in regards to the DPS shortcodes I run on the home page to display some recent posts from specific categories.

    I also use the DPS shortcodes for related posts from same categories. In some cases there are 2 categories so it spits out a row of columns of related categories when the post is in more than one category.

    I’m getting an error about Multiple ItemList markups on a page are not allowed when I use more than one DPS shortcode too.

    What would be the best way to approach this? Disable that output? or is there a way to tell the shortcode to only use the primary category? I dont think I saw that in your documentation about it.

    • Bill Erickson says

      I assume you’re using this code snippet to add the ItemList markup, correct?

      I just updated the snippet so you can add disable_schema="true" to disable the schema output on your secondary shortcodes.

      Alternatively, you could use this version to only enable it on shortcodes that have enable_schema="true".

      You can decide which approach fits your needs better: opt-in or opt-out. In either case, you should only have one ItemList on the page.

  8. Rob says

    Thank you. I’m going to have to disable it completely unfortunately as it’s my Content Aware Sidebars that’s causing the issue. I have It display related posts from the current category using DPS, but CAS is triggered for each category the post is in, so calls DPS for each one, spitting out multiple ItemList Schemas.

    I HAVE implemented your new DPS transient cache though.

    Thanks again Bill.

  9. Hannah says

    Thank you so much for this Bill!
    Since I’m not familiar with PHP (I’m always so scared of adding stuff for fear of breaking up my pages), can you tell me where to add the code inside functions.php? At the very top or bottom? Thank you again!

    • Bill Erickson says

      If you’re not comfortable with writing PHP, I recommend installing my plugin instead. There’s no configuration or coding necessary.

  10. Miklos Mayer says

    Bill, thank you so much for this awesome work you do for the Genesis community!
    Really highly appreciate it!

    Installed your plugin, and it works just as you described, I’ve checked the schema data a minute after install, and it looked good 🙂

    Cheers from Hungary 🙂

  11. G'will Chijioke says

    Hi Bill, thanks for this post.

    I prefer putting the code in my theme and i just have one question.

    how do i use this code ” include_once( get_stylesheet_directory() . ‘/inc/disable-genesis-schema.php’ ); ” ?

    Do i just paste it in my functions.php file?

    • Bill Erickson says

      Yes, you put it in functions.php, assuming you added the disable-genesis-schema.php file into the /inc/ directory in your child theme. If you placed it elsewhere, update that path accordingly.

  12. Rajesh says

    Hello Bill,

    Thanks a lot for coming up with a quick solution.

    I want to ask one question: Yoast SEO is not adding WPHeader, WPSideBar, WPFooter, SiteNavigationElement, etc. What about that? Aren’t they important? Please let me know.

    Thanks once again.

    • Bill Erickson says

      I’m not a Schema / SEO expert, but my guess is Yoast didn’t include those items because they aren’t very important from an SEO perspective. The most important thing is providing structured data about the main content of the page, whether that be an article, recipe, event, or anything else.

      That said, I don’t think you would have any issues including all the non-article-related schema since it doesn’t duplicate anything found in Yoast SEO. I made the plugin filterable so you can decide exactly which schema items get removed and which remain.

      If you would like to keep the WPHeader, WPSideBar, WPFooter, and SiteNavigationElement, add this to your theme’s functions.php file: https://gist.github.com/billerickson/e7434b8ae761f452831ecd7eeb79c963

      I’ve updated the post above to include a note about saving some schema.

  13. Cathy Tibbles says

    Thank you so much for sharing this code! I’m wondering about why you removed some elements with a second function instead of just removing them from be_disable_genesis_schema()? Is this a long-term use kinda thing? I like to follow your logic with these things. And thank you SO much for teaching us the proper way to do them!

    We started using core plugins because of your tutorials years ago. Thank you!!

    • Bill Erickson says

      If you have the plugin installed, it’s best to make your customizations using the filter in your theme or core functionality plugin so they aren’t lost if the plugin is updated.

      • Cathy Tibbles says

        I’m using the code in a core plugin. So I just commented out the elements I don’t want removed from Genesis. Is there a reason to do it with another function?

  14. Monica says

    I downloaded the plugin twice and it’s not working for me.

    It still says Warning: Illegal string offset ‘width’ in /home/mindfull/public_html/wp-content/plugins/wordpress-seo/frontend/schema/class-schema-image.php on line 149

    Warning: Illegal string offset ‘height’ in /home/mindfull/public_html/wp-content/plugins/wordpress-seo/frontend/schema/class-schema-image.php on line 150

    It says just download and activate. But do I need to do anything else?

  15. Mary Ann says

    This was recommended to me by my tech support so I added the plugin and it disabled Genesis. Now my traffic and affiliate sales are declining over the past two weeks. Coincidence? I’ve heard others say the same thing. Bill do you have any insight here? Thanks.

    • Bill Erickson says

      This plugin is designed to disable the Genesis schema data, and should only be used if you have Yoast SEO installed as well. Yoast now includes schema, and this plugin ensures you don’t load duplicate schema.

      I can’t provide any insight on your declining traffic. If you think it may be related to removing Genesis schema, I recommend you contact your tech support and ask them to disable Yoast schema instead of using this plugin. That will restore your site back to how it was prior to Yoast SEO 11 being released with schema.

  16. Dedra says

    Genesis just released a 2.10.0 update to their themes along with Yoasts 11.1 update. I updated Yoast but I’m nervous to update Genesis. Is it safe to update while I have this plugin installed, or at all for that matter? A few people have said they’ve been experiencing problems with the new update but I’d like to know your opinion.

    • Bill Erickson says

      My plugin is safe to use with all versions of Genesis, including the newly released 2.10. The new version of Genesis does not address the Yoast schema issue in any way, and the official recommendation from StudioPress is to install my plugin for now.

      There was an issue in Genesis 2.10 on sites using old versions of WordPress (4.9.10). If you aren’t using WordPress 5.0 or 5.1 yet, I recommend holding off on updating Genesis. Genesis 2.10.1 should fix this bug in the next day or two.

  17. Marlan from RV52 says

    Thanks. I’d love to see example codes of how to extend Yoast with say, a recipe, place, or event.

  18. Tania Sheff says

    Hi Bill! I was hoping maybe you can help me with a small issue I am having. I disabled Genesis schema, per your recommendations. Everything worked great, but I do have one warning when I check my Structured Data. It says: “The mainEntityOfPage field is recommended. Please provide a value if available”. Do you happen to know how to fix it? Thank you SO MUCH!

    • Bill Erickson says

      Did you customize the Yoast SEO schema with code, or are using a plugin to add the recipe schema? As far as I know, Yoast SEO does not provide recipe schema but your site is displaying it.

      Whatever is making the customization should be defining the mainEntityOnPage.

  19. Jennifer Quisenberry says

    Thank you! This was so helpful and made it a piece of cake to do. No errors found after I did it.

  20. Dhananjay Bhardwaj says

    Hi Bill. First off, thanks for this!

    Last year, I decided to disable Genesis’ Schema completely and replace that with custom Schema, like BlogPosting on posts, Website on the homepage, etc.

    Now that Yoast has improvised on the Schema part, I feel it would be nice to move to that, knowing that manual schema implementation could often be risky, for various reasons of course.

    My questions is: Do you think if I completely strip out ALL of the Genesis Schema, and only leave Yoast’s Schema there, would there be any adverse effects of it? Like Genesis has supports SD for elements like Navigation, Header, Footer, etc.

    • Bill Erickson says

      No, there shouldn’t be any adverse effects from stripping out Genesis schema. There is no SEO benefit for the schema on navigation, header, sidebar, and footer. Any schema that may have an effect on SEO is inside Yoast SEO’s schema already.

Leave A Reply