Filter Hooks in SNIP v2.13

In this post you’ll find a list of filter hooks that SNIP provides. Filter allow you to override certain code.

Structured Data Output

Hook into the list of snippets

Hook into all Snippets that are returned on the frontend:

apply_filters('wpbuddy/rich_snippets/model/schemas/get', $rich_snippets, $post_id)
  • $rich_snippets (Rich_Snippet[])
  • $post_id (int)

Change a value from a snippet

apply_filters( 'wpbuddy/rich_snippets/rich_snippet/value', $var, $field_type, $snippet, $meta_info );
  • $var (mixed)
  • $field_type (string)
  • $snippet (Rich_Snippet)
  • $meta_info (array)

Change a value from a snippet (dynamic filter)

apply_filters( 'wpbuddy/rich_snippets/rich_snippet/value/{$field_type}', $var, $this, $meta_info );
  • $var (mixed)
  • $snippet (Rich_Snippet)
  • $meta_info (array)

Inject custom JSON+LD data

$json_ld_data = apply_filters( 'wpbuddy/rich_snippets/rich_snippet/json+ld', $json_ld_data, $meta_info );
  • $json_ld_data (object)
  • $meta_info (array)

Change JSON+LD value (from custom code)

apply_filters( 'wpbuddy/rich_snippets/rich_snippet/json+ld/value', $value, $meta_info );
  • $value (mixed)
  • $meta_info (array)

Change JSON+LD value from custom code (dynamic)

apply_filters( 'wpbuddy/rich_snippets/rich_snippet/json+ld/value/{$key}', $value, $meta_info );
  • $value (mixed)
  • $meta_info (array)

Ruleset match filter.

Bail early on ruleset match.

apply_filters( 'wpbuddy/rich_snippets/ruleset/match', $bail_early, $ruleset );
  • $bail_early (bool|null)
  • $ruleset (Position_Ruleset)

Loop functionality

Add loop items

apply_filters( 'wpbuddy/rich_snippets/rich_snippet/loop/items', $items, $snippet, $post_id )
  • $items (array)
  • $snippet (Rich_Snippet)
  • $post_id (int)