aioseo_schema_graphs

Purpose

This filter can be used to filter the JSON schema graphs (rich snippets) that AIOSEO outputs for the page.

Arguments (1)

  1. $graphs (array) – The names of graphs that will be output.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below, Article is added to the list of graphs that will be output for posts.

add_filter( 'aioseo_schema_graphs', 'aioseo_filter_schema_graphs' );

function aioseo_filter_schema_graphs( $graphs ) {
   if ( is_singular( 'post' ) && ! in_array( 'Article', $graphs, true ) ) {
      $graphs[] = 'Article';
   }
   return $graphs;
}