Recently when improving the EEAT of one of my main sites I added the reviewedBy
schema to all relevant posts, and in this post I’ll show how you can easily do that too!
The presence of this schema signals to Google that the post’s content has been reviewed for accuracy and/or completeness which has the potential to help with rankings.
Below I’ll show you how you can easily add a “Reviewed By” field to your posts that automatically adds the appropriate schema.
Setup
For this particular setup I’m using the following free plugins:
You can use different plugins by modifying the process below. These were used since they were already installed on the particular site.
1) Adding the “Reviewed By” field on Posts using ACF
First, we just need to create a new field using ACF. This will add a new input on your Posts in WordPress so that you choose the User that has reviewed that post.
On the ACF page in the WP Admin click Add New next to Field Groups. If you already have a Field Group for Posts that you would like to use then you can also just click on that instead of adding a new one.
Once you’ve added a new field group (or selected an existing one) it is time to add the field. Make sure to set a title for the Field Group if you haven’t already (something like “Custom Post Settings” or “EEAT” is fine).
Under the “Fields” section you can enter the following settings:
Double-check you added the settings correctly for your new field and click Save Changes at the top.
Now you should see a new Reviewed By field in WordPress when you are adding or editing a Post. It will either be at the bottom of the page or in the sidebar depending on your ACF settings.
2) Add the Code Snippet for Creating the Schema
Using the Code Snippets plugin (recommended) or by modifying your theme’s code you can add the following snippet:
add_filter('wpseo_schema_webpage', function($data) {
$data['name'] = do_shortcode($data['name']);
if (!is_singular('post')) {
return $data;
}
$reviewed_by = get_field('reviewed_by');
if ($reviewed_by) {
$data['reviewedBy'] = array(
'@type' => 'Person',
'name' => $reviewed_by->display_name
);
$linkedin_url = get_user_meta($reviewed_by->id, 'linkedin', true);
if ($linkedin_url) {
$data['reviewedBy']['sameAs'] = [$linkedin_url];
}
}
return $data;
});
This code simply hooks into the wpseo_schema_webpage
filter that is provided by Yoast. It checks if the reviewed_by
field is set for the current post. If it is set then it adds the appropriate reviewedBy
schema.
It sets the user’s name in the schema and checks if the user has a LinkedIn URL. If they do, then it sets the reviewer’s sameAs
field to their LinkedIn profile page which helps link the reviewer.
This code could be modified to work with other SEO plugins, to set different schema properties, or you could even forgo the ACF field entirely and just set the reviewedBy
schema for all posts (or by category, etc).
Make sure the code snippet has been activated.
3) Done!
Once the field has been set and the code snippet is installed correctly then the schema should just get added automatically.
Make sure to test using a tool such as Schema.org’s Validator.
Bonus: Displaying the Reviewer to the Reader
The following code snippet creates a shortcode, post_info_reviewed_by
, that will show the reader that the page has been reviewed and will link to that author’s page.
function post_info_reviewed_by() {
if (!is_single()) {
return '';
}
$reviewed_by = get_field('reviewed_by');
if ($reviewed_by) {
$reviewer_url = get_author_posts_url($reviewed_by->id);
return 'Reviewed by <a href="' . $reviewer_url . '">' . $reviewed_by->display_name . '</a> · ';
}
return '';
}
add_shortcode('post_info_reviewed_by', 'post_info_reviewed_by');
It is up to your theme on how you would add this to your posts. Some themes provide a setting like “Edit Post Info” where you could add this shortcode to display the reviewer next to the Author.