Get last word from URL after a slash in PHP Worpdress

Working with Php scripting language and requirement like set menu link active base on current loading page than 1st task is you have to identify which page loaded and based on that you able to assign active or similar any other class to Menu link which make menu different (active).

#
$current_page = basename(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));

Leave a Comment

Scroll to Top