WordPress at a glance
function is not described

_truncate_post_slug() WP 3.6.0

Truncate a post slug.

  • See: utf8_uri_encode()

No Hooks.

Return

String. The truncated slug.

Usage

_truncate_post_slug( $slug, $length );
$slug(string) (required)
The slug to truncate.
$length(int)
Max length of the slug.
Default: 200 (characters)

Code of truncate post slug: wp-includes/post.php VER 5.0.3

<?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, '-' );
}