March 04, 2013

If you are looking for a function that get the last segment from a url, this is what you want. Just copy it into your functions.php.

//get last segment from url
function get_last_segment( $url ) {
$path = parse_url( $url, PHP_URL_PATH ); // to get the path from a whole URL

Read more »