wpseek.com
A WordPress-centric search engine for devs and theme authors
url_shorten › WordPress Function
Since1.2.0
Deprecatedn/a
› url_shorten ( $url, $length = 35 )
Parameters: (2) |
|
Returns: |
|
Defined at: |
|
Codex: | |
Change Log: |
|
Shortens a URL, to be used as link text.
Source
function url_shorten( $url, $length = 35 ) {
$stripped = str_replace( array( 'https://', 'http://', 'www.' ), '', $url );
$short_url = untrailingslashit( $stripped );
if ( strlen( $short_url ) > $length ) {
$short_url = substr( $short_url, 0, $length - 3 ) . '…';
}
return $short_url;
}