wpseo_schema_(type)
Filter: 'wpseo_schema_<type>' - Allows changing graph piece output by @type.
Использование
add_filter( 'wpseo_schema_(type)', 'wp_kama_wpseo_schema_type_filter', 10, 4 ); /** * Function for `wpseo_schema_(type)` filter-hook. * * @param array $graph_piece The graph piece to filter. * @param Meta_Tags_Context $context A value object with context variables. * @param Abstract_Schema_Piece $graph_piece_generator A value object with context variables. * @param Abstract_Schema_Piece[] $graph_piece_generators A value object with context variables. * * @return array */ function wp_kama_wpseo_schema_type_filter( $graph_piece, $context, $graph_piece_generator, $graph_piece_generators ){ // filter... return $graph_piece; }
- $graph_piece(массив)
- The graph piece to filter.
- $context(Meta_Tags_Context)
- A value object with context variables.
- $graph_piece_generator(Abstract_Schema_Piece)
- A value object with context variables.
- $graph_piece_generators(Abstract_Schema_Piece[])
- A value object with context variables.
Где вызывается хук
wpseo_schema_(type)
yoast/src/generators/schema-generator.php 357
$graph_piece = \apply_filters( 'wpseo_schema_' . $type, $graph_piece, $context, $graph_piece_generator, $graph_piece_generators );
Где используется хук в Yoast SEO
yoast/src/generators/schema-generator.php 302
\add_filter( 'wpseo_schema_webpage', [ $this, 'protected_webpage_schema' ], 1 );