How to get current page name in wordpress?

by dalton_moen , in category: PHP CMS , a year ago

How to get current page name in wordpress?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lily , a year ago

@dalton_moen 

To get the current page name in WordPress, you can use the following code:

1
2
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.

Related Threads:

How to get current page url in wordpress?
How to get the current route name in Laravel?
How to get the current route name in vue.js?
How to get current product category name in woocommerce?
How to get title of current page with woocommerce?
How to get page number from item name in oracle?