Google Search Console “performer” warning with Yoast SEO
-
The Yoast SEO plugin has special processing for events from The Events Calendar (TEC), and adjusts TEC’s event schema slightly. As part of that, it removes the “performer” section of the schema, which is not supported by TEC and is normally just copied from the “organizer” information.
Google Search Console flags the lack of performer information as a warning, even though it’s optional.
I created code that will restore the performer information to the Yoast schema, as it was originally set by TEC. It can be placed in the functions.php file, or added as a plugin (if you know how to do that).
function my_fix_event_schema($graph, $context) { if (!is_array($graph)) return $graph; $newgraph = []; foreach ($graph as $one) { if (strcmp($one['@type'], 'Event') === 0 && !isset($one['performer'])) { $one['performer'] = new \stdClass(); $one['performer']->{'@type'} = 'Person'; $one['performer']->name = (isset($one['organizer']->name) ? $one['organizer']->name : 'Unknown'); } $newgraph[] = $one; } return($newgraph); } add_filter('wpseo_schema_graph', 'my_fix_event_schema', 9999, 2);
Use at your own risk. I make no guarantees or warranties.
- The topic ‘Google Search Console “performer” warning with Yoast SEO’ is closed to new replies.