I'm working on a custom template. A couple of weeks ago, I was trying to find code to get the page slug of the currently viewed Page. After some searching, I found a webpage that said using the following variable:
on a WordPress Page would return the slug of the Page currently being viewed. I used this in my template like so:
It seems to work perfectly, doing exatly what I want. However, I'm trying to find *where* I got that info from, because now, two weeks later, I can't find the page that gave me that info, and looking over the code, I can't figure out *why* this works, since "$pagename" doesn't look anything like a normal wordpress template tag or function.
Just for additional info, I'm not passing any query string variables in my urls - this works on pages with urls like "localhost:4000/illustration/".
Can anyone tell me if this is actually a legitimate way to get the slug name of a page?