I'd like to understand how to obtain the word "author" from the url as with


I am using wordpress - in order to always realize that the URL will appear the same as that. I have used Regex to obtain everything following the "/" but that is an excessive amount of. Here's that code.

preg_match("/[^\/]+$/",$_SERVER['REQUEST_URI'], $matches);
$author = $matches[0]; // test

Any help?

$key = array_keys($_GET);
$key = $key[0];

$_SERVER['QUERY_STRING'] should have the ability to obtain the 'author=seth-godin' part, then just explode at &lifier (if multiple parameters), or at = and employ the very first value i.e. explode('=',$_SERVER['QUERY_STRING']. zero index of this array = author. (much like below)

array_secrets($_GET) will return array(=>'author')