wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_truncate_slug is private and should not be used in themes or plugins directly.
wp_truncate_slug › WordPress Function
Seit7.2.0
Veraltetn/v
› wp_truncate_slug ( $slug, $length = 200 )
| Zugriff: |
|
| Parameter: (2) |
|
| Siehe: | |
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
Truncates a slug to a given length.
Non-ASCII slugs are stored percent-encoded, so the slug is truncated on a character boundary to avoid cutting a percent-encoded sequence in half.Ähnliche Funktionen: _truncate_post_slug, wp_unique_term_slug, wp_update_plugin, wp_update_plugins, wp_trusted_keys
Quellcode
function wp_truncate_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, true );
}
}
return rtrim( $slug, '-' );
}