How to remove the person schema and the author property of the article schema in the Yoast SEO plugin for WordPress

Published: June 8, 2019 | Last Modified: May 15, 2022

Today I'm going to talk you about how you can remove the person schema and the author section of the article schema in the Yoast SEO plugin for WordPress. I think this is going to be a problem for a lot of people using version 11+ of the Yoast SEO plugin for WordPress.

In versions 11+ Yoast have added a ton of new schema markup, which is great, but I had a problem for a website that was configured in Yoast SEO as an organisation (you can configure your site as either representing a person or an organisation). The issue was, that like a lot of WordPress sites, they were using one login to post their blog articles. This user / login was not actually a person and this was the root of the issue because Yoast SEO version 11+ adds the person and author schema markup to all WordPress posts (articles in the schema). So you end up with something like this:

{
    "@type": "Article",
    "@id": "https://jodyvanv.com/how-to-remove-change-person-author-schema-yoast-seo-plugin-wordpress/#article",
    "isPartOf": {
        "@id": "https://jodyvanv.com/how-to-remove-change-person-author-schema-yoast-seo-plugin-wordpress/#webpage"
    },
    "author": {
        "@id": "https://jodyvanv.com/#/schema/person/628d076fe5ee15b9eec817c8e4ee18cd" //Shared Login Non-Person
    },
    "headline": "How to remove / change the person / author schema in the Yoast SEO plugin for WordPress",
    "datePublished": "2019-06-08T11:02:56+00:00",
    "dateModified": "2019-06-08T13:12:07+00:00",
    "mainEntityOfPage": {
        "@id": "https://jodyvanv.com/how-to-remove-change-person-author-schema-yoast-seo-plugin-wordpress/#webpage"
    },
    "wordCount": 352,
    "publisher": {
        "@id": "https://jodyvanv.com/#organization"
    },
    "articleSection": [
        "SEO",
        "Wordpress"
    ],
    "inLanguage": "en-GB"
},
{
    "@type": "Person",
    "@id": "https://jodyvanv.com/#/schema/person/628d076fe5ee15b9eec817c8e4ee18cd", //Shared Login Non-Person
    "name": "Shared Login Name"
}

Essentially you end up with Person and Author schema markup which references your shared login which actually represents nothing and no one. So how do you remove the person schema and the author property of the article schema? You can use the Yoast SEO plugin's API.

Firstly, you can simply remove the Person schema entirely from all posts by adding this to your theme's functions.php file:

//disable Yoast SEO plugin @Person schema on posts
add_filter( 'wpseo_schema_needs_author', '__return_false' );

Now your schema output for the article (post) will not include the Person type:

{
    "@type": "Article",
    "@id": "https://jodyvanv.com/how-to-remove-change-person-author-schema-yoast-seo-plugin-wordpress/#article",
    "isPartOf": {
        "@id": "https://jodyvanv.com/how-to-remove-change-person-author-schema-yoast-seo-plugin-wordpress/#webpage"
    },
    "author": {
        "@id": "https://jodyvanv.com/#/schema/person/628d076fe5ee15b9eec817c8e4ee18cd" //Shared Login Non-Person
    },
    "headline": "How to remove / change the person / author schema in the Yoast SEO plugin for WordPress",
    "datePublished": "2019-06-08T11:02:56+00:00",
    "dateModified": "2019-06-08T13:12:07+00:00",
    "mainEntityOfPage": {
        "@id": "https://jodyvanv.com/how-to-remove-change-person-author-schema-yoast-seo-plugin-wordpress/#webpage"
    },
    "wordCount": 352,
    "publisher": {
        "@id": "https://jodyvanv.com/#organization"
    },
    "articleSection": [
        "SEO",
        "Wordpress"
    ],
    "inLanguage": "en-GB"
}

However, within the article schema you still have the author property which is outputting your shared login non-person. My solution was again to use the Yoast SEO plugin's API, but this time to just remove the output of this author property within the article schema as follows (add this to your functions.php file):

/**
 * Remove author from the Yoast SEO plugin Article schema
 *
 * @param array $graph_piece Yoast schema pieces.
 *
 * @return array
 */
function vanv_remove_author_wpseo_article_schema( $graph_piece ) {

	unset( $graph_piece['author'] );

	return $graph_piece;

}

add_filter( 'wpseo_schema_article', 'vanv_remove_author_wpseo_article_schema' );

This removes the author property from the article scheme so your shared login person is no longer referenced as the author:

{
    "@type": "Article",
    "@id": "https://jodyvanv.com/how-to-remove-change-person-author-schema-yoast-seo-plugin-wordpress/#article",
    "isPartOf": {
        "@id": "https://jodyvanv.com/how-to-remove-change-person-author-schema-yoast-seo-plugin-wordpress/#webpage"
    },
    "headline": "How to remove / change the person / author schema in the Yoast SEO plugin for WordPress",
    "datePublished": "2019-06-08T11:02:56+00:00",
    "dateModified": "2019-06-08T13:12:07+00:00",
    "mainEntityOfPage": {
        "@id": "https://jodyvanv.com/how-to-remove-change-person-author-schema-yoast-seo-plugin-wordpress/#webpage"
    },
    "wordCount": 352,
    "publisher": {
        "@id": "https://jodyvanv.com/#organization"
    },
    "articleSection": [
        "SEO",
        "Wordpress"
    ],
    "inLanguage": "en-GB"
}

And there you have it, I hope this helps someone out, tweet me @jodyvanv if it does. Here's the full snippet to add to your WordPress theme's functions.php file:

//disable Yoast SEO plugin @Person schema on posts
add_filter( 'wpseo_schema_needs_author', '__return_false' );

/**
 * Remove author from the Yoast SEO plugin @Article schema
 *
 * @param array $graph_piece Yoast schema pieces.
 *
 * @return array
 */
function vanv_remove_author_wpseo_article_schema( $graph_piece ) {

	unset( $graph_piece['author'] );

	return $graph_piece;

}

add_filter( 'wpseo_schema_article', 'vanv_remove_author_wpseo_article_schema' );