On this page
WP_REST_Controller::sanitize_slug( string $slug ): string
Sanitizes the slug value.
Description
See also
Parameters
$slugstring 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. View all references
public function sanitize_slug( $slug ) {
return sanitize_title( $slug );
}
Related
Uses
| Uses | Description |
|---|---|
| sanitize_title() wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
Changelog
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_controller/sanitize_slug