---
title: Filter the generated JSON-LD schemas
url: "https://www.seopress.org/support/hooks/filter-the-generated-json-ld-schemas/"
lang: en-US
updated: 2026-10-20
hook_name: seopress_json_schema_generator_get_jsons, seopress_json_schema_generator_get_jsons_encoded
required_version: 4.5
---

# Filter the generated JSON-LD schemas

- **Hook name:** `seopress_json_schema_generator_get_jsons, seopress_json_schema_generator_get_jsons_encoded`
- **Required version:** 4.5

```php
<?php
/**
 * Filter all schemas before they are encoded to JSON-LD.
 *
 * @param array $data Schemas (arrays), keyed by schema.
 * @return array
 */
function sp_json_schema_generator_get_jsons( $data ) {
	foreach ( $data as $key => $schema ) {
		if ( is_array( $schema ) && isset( $schema['@type'] ) && 'Article' === $schema['@type'] ) {
			$data[ $key ]['publisher']['name'] = get_bloginfo( 'name' );
		}
	}

	return $data;
}
add_filter( 'seopress_json_schema_generator_get_jsons', 'sp_json_schema_generator_get_jsons' );

/**
 * Filter the final JSON-LD strings (one per schema), after encoding.
 *
 * @param array $data JSON-LD strings.
 * @return array
 */
function sp_json_schema_generator_get_jsons_encoded( $data ) {
	return $data;
}
add_filter( 'seopress_json_schema_generator_get_jsons_encoded', 'sp_json_schema_generator_get_jsons_encoded' );
```

Source: [https://gist.github.com/wp-seopress/5a4919269f31ecbbfe1d36747416f73f](https://gist.github.com/wp-seopress/5a4919269f31ecbbfe1d36747416f73f)



