Uses
Uses | Description |
---|---|
wp-includes/formatting.php: utf8_uri_encode() | Encode the Unicode values to be used in the URI. |
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use utf8_uri_encode() instead.
Truncate a post slug.
(string) (Required) The slug to truncate.
(int) (Optional) Max length of the slug. Default 200 (characters).
Default value: 200
(string) The truncated slug.
File: wp-includes/post.php
function _truncate_post_slug( $slug, $length = 200 ) { if ( strlen( $slug ) > $length ) { $decoded_slug = urldecode( $slug ); if ( $decoded_slug === $slug ) { $slug = substr( $slug, 0, $length ); } else { $slug = utf8_uri_encode( $decoded_slug, $length ); } } return rtrim( $slug, '-' ); }
Version | Description |
---|---|
3.6.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_truncate_post_slug