Skip to content

Instantly share code, notes, and snippets.

@dededey
Created April 1, 2015 08:11
Show Gist options
  • Save dededey/a0419d29b0f9d76ea708 to your computer and use it in GitHub Desktop.
Save dededey/a0419d29b0f9d76ea708 to your computer and use it in GitHub Desktop.
get wp segment uri
$segments = explode('/', trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/'));
$numSegments = count($segments);
$currentSegment = $segments[$numSegments - 1];
echo 'Current Segment: ' , $currentSegment;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment