Codex

Function Reference/url shorten

Contents

Description

Shortens URLs. Removes http://, www., and truncates the remaining URL to 35 characters, including '...' if the URL is longer than that.

WordPress uses it to display URLs on the link management screen.

Usage

 <?php echo url_shorten('http://www.example.com/an/article/with/a/very/long/url'); ?> 

This would print:

 example.com/an/article/with/a/ve... 

Changelog

Since: 1.2.1

Source File

url_shorten() is located in wp-admin/includes/misc.php.

Related

See also index of Function Reference and index of Template Tags.