• 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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thanks for posting that. For some reason, the function gave me an error running in functions.php on WPEngine but i was able to find a fix for another search console error here in case it helps someone else: https://theeventscalendar.com/known-issues/#event-status

    Thread Starter Chad Cloman

    (@chadcloman)

    I think it may have been a copy/paste issue. I had a difficult time copying it from that code block because the scroll bar at the bottom covered the last line. Let me try it this way, with comments to make the copy/paste easier:

    // Begin
    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);
    
    // End
    
    • This reply was modified 2 years, 3 months ago by Chad Cloman.
    • This reply was modified 2 years, 3 months ago by Chad Cloman.
    • This reply was modified 2 years, 3 months ago by Chad Cloman.
    Thread Starter Chad Cloman

    (@chadcloman)

    Also, if your functions.php doesn’t already have it, place this line at the very top:

    <?php
    
    
    • This reply was modified 2 years, 3 months ago by Chad Cloman.

    Yes, I was concerned about the curse of the curly quotes on paste but it was fine. Still crashing one site but I have some other events customizations there that I think are conflicting. Tried it on another site’s functions.php and your code works beautifully. This will be my goto fix until the Yoast and TEC teams end their conflict. Thanks!

    • This reply was modified 2 years, 3 months ago by 4briang.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Google Search Console “performer” warning with Yoast SEO’ is closed to new replies.