WP_REST_Controller::sanitize_slug() WordPress Method
The WP_REST_Controller::sanitize_slug() method is used to sanitize a string for use as a slug. This is useful when you need to ensure that a string is safe to use as a slug, for example when creating a new post or taxonomy term.
WP_REST_Controller::sanitize_slug( string $slug ) #
Sanitizes the slug value.
Description
See also
Parameters
- $slug
(string)(Required)Slug value passed in request.
Return
(string) Sanitized value for the slug.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-controller.php
public function sanitize_slug( $slug ) { return sanitize_title( $slug ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |