WP_REST_Controller::sanitize_slugpublicWP 4.7.0

Sanitizes the slug value.

{@internal We can't use sanitize_title() directly, as the second parameter is the fallback title, which would end up being set to the request object.}

Method of the class: WP_REST_Controller{}

No Hooks.

Returns

String. Sanitized value for the slug.

Usage

$WP_REST_Controller = new WP_REST_Controller();
$WP_REST_Controller->sanitize_slug( $slug );
$slug(string) (required)
Slug value passed in request.

Changelog

Since 4.7.0 Introduced.

WP_REST_Controller::sanitize_slug() code WP 7.0

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