wpseo_author_schema_ability_fields
Filter: wpseo_author_schema_ability_fields Allows adding author schema settings that the author schema abilities can write.
Each field is keyed by its name and maps to the JSON schema of its value. By default, the value is saved as a single user meta value, keyed by the name of the field. That only works for a field whose schema type is 'string', as the value is sanitized as text, so a field of any other type without its own 'repository' is dropped.
A field stored differently, for example as an entry of an array user meta value, comes with a 'repository' key next to the schema, holding an Author_Schema_Field_Repository_Interface that reads, sanitizes and saves it. A field whose 'repository' is not one is dropped, so it is never saved in the wrong place.
Validation beyond the schema goes in an optional 'validate_callback' key next to the schema. It receives the value and the field name, and returns a warning to skip saving the field or null to save it. The warning is relayed to the user, so it should explain why the value was not saved. A field whose 'validate_callback' is not callable is dropped, so it is never saved unvalidated. The fields of Yoast SEO come with their own 'validate_callback', which must be kept.
Person social profiles are validated and saved by the validator they are registered with through the wpseo_person_social_profile_fields instead.
Использование
add_filter( 'wpseo_author_schema_ability_fields', 'wp_kama_wpseo_author_schema_ability_fields_filter' ); /** * Function for `wpseo_author_schema_ability_fields` filter-hook. * * @param array> $fields The JSON schema of each * field, keyed by field name. * * @return array
- $default_fields(array<string,)
- array<string, mixed>> $fields The JSON schema of each field, keyed by field name.
Где вызывается хук
wpseo_author_schema_ability_fieldsyoast/src/abilities/infrastructure/author-schema-field-map.php 114return \apply_filters( 'wpseo_author_schema_ability_fields', $default_fields );Где используется хук в Yoast SEO
Использование не найдено.