W3cubDocs

/WordPress

WP_REST_Font_Faces_Controller::sanitize_font_face_settings( string $value ): array

Sanitizes the font face settings when creating a font face.

Parameters

$valuestringrequired
Encoded JSON string of font face settings.

Return

array Decoded and sanitized array of font face settings.

Source

public function sanitize_font_face_settings( $value ) {
	// Settings arrive as stringified JSON, since this is a multipart/form-data request.
	$settings = json_decode( $value, true );
	$schema   = $this->get_item_schema()['properties']['font_face_settings']['properties'];

	// Sanitize settings based on callbacks in the schema.
	foreach ( $settings as $key => $value ) {
		$sanitize_callback = $schema[ $key ]['arg_options']['sanitize_callback'];
		$settings[ $key ]  = call_user_func( $sanitize_callback, $value );
	}

	return $settings;
}

Changelog

Version Description
6.5.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_font_faces_controller/sanitize_font_face_settings