PHP: grab page name
-
Hello,
I am trying to grab the page name of a page through PHP.
I have found this code online which is working:global $post; $pagename = $post->post_name;However, my page is
example.com/slug/pagename/
With the code above$post = sluginstead of$post = pagename.How can I fix that? I tried to use
$pagename = $post->"user"->post_namebut it didn’t work.Thank you in advance
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘PHP: grab page name’ is closed to new replies.