Yoast\WP\SEO\Bulk_Editor\Infrastructure\Updates
Meta_Writer::sanitize
Sanitizes a value the same way the post editor sanitizes meta values.
Registered fields are routed through the canonical meta sanitizer so the field-specific handling and the wpseo_sanitize_post_meta_* filter run, matching a normal post save. Fields that are not registered (for example the Open Graph fields when social appearance is disabled) have no canonical sanitize callback, so they fall back to plain text sanitization.
Метод класса: Meta_Writer{}
Хуков нет.
Возвращает
Строку. The sanitized value.
Использование
// private - только в коде основоного (родительского) класса $result = $this->sanitize( $key, $value ): string;
- $key(строка) (обязательный)
- The meta key (without prefix) the value is stored under.
- $value(строка) (обязательный)
- The value to sanitize.
Код Meta_Writer::sanitize() Meta Writer::sanitize Yoast 28.3
private function sanitize( string $key, string $value ): string {
$meta_key = WPSEO_Meta::$meta_prefix . $key;
if ( isset( WPSEO_Meta::$fields_index[ $meta_key ] ) ) {
return WPSEO_Meta::sanitize_post_meta( $value, $meta_key );
}
return WPSEO_Utils::sanitize_text_field( \trim( $value ) );
}