WP_REST_Global_Styles_Controller::_sanitize_global_styles_callback() WordPress Method

The WP_REST_Global_Styles_Controller::_sanitize_global_styles_callback() method is used to sanitize global style settings when saving them via the WordPress REST API. This ensures that only valid data is saved to the database, and that any malicious data is removed.

WP_REST_Global_Styles_Controller::_sanitize_global_styles_callback( string $id_or_stylesheet ) #

Sanitize the global styles ID or stylesheet to decode endpoint.


Description

For example, wp/v2/global-styles/twentytwentytwo%200.4.0 would be decoded to twentytwentytwo 0.4.0.


Top ↑

Parameters

$id_or_stylesheet

(string)(Required)Global styles ID or stylesheet.


Top ↑

Return

(string) Sanitized global styles ID or stylesheet.


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php

	public function _sanitize_global_styles_callback( $id_or_stylesheet ) {
		return urldecode( $id_or_stylesheet );
	}

Top ↑

Changelog

Changelog
VersionDescription
5.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.