To get the current page name in WordPress, you can use the following code:
global $wp; $current_page_name = $wp->request;
This code uses the global
$wp variable to access the current request and gets the current page name by accessing the
request property. You can store the page name in the
$current_page_name variable for further use.