wpseo_global_setting_ability_fields
Filter: wpseo_global_setting_ability_fields Allows adding fields to the archive and special page SEO settings abilities.
Each field is keyed by its name and maps to the JSON schema of its value, along with an 'option_patterns' key: the pattern of the Yoast SEO option the field is stored in, keyed by the name of each target that has the field. The archive of a content type fills in its post type for the %s placeholder. A field without valid option patterns is dropped, so it is never saved in the wrong place. The value is saved through the options helper, so it is sanitized like it is when saved from the settings page.
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.
Использование
add_filter( 'wpseo_global_setting_ability_fields', 'wp_kama_wpseo_global_setting_ability_fields_filter' ); /** * Function for `wpseo_global_setting_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_global_setting_ability_fieldsyoast/src/abilities/infrastructure/global-setting-field-map.php 90return \apply_filters( 'wpseo_global_setting_ability_fields', $default_fields );Где используется хук в Yoast SEO
Использование не найдено.