W3cubDocs

/WordPress

WP_REST_Controller::sanitize_slug( string $slug ): string

Sanitizes the slug value.

Description

See also

Parameters

$slugstringrequired
Slug value passed in request.

Return

string Sanitized value for the slug.

Source

public function sanitize_slug( $slug ) {
	return sanitize_title( $slug );
}

Changelog

Version Description
4.7.0 Introduced.

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