WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This the url format: www.mysite.com/pageone

How do I get the page name? what is the wordpress function/method for this?

bloginfo('name') return the site name. I want the function that returns (return not echo) the name of the current page.

share|improve this question
I am not sure what you want to get from what input. Page's title from page's URL? Page slug from something? Please write it out more clearly. – Rarst Jan 18 '11 at 9:12
@Rarst: I clarified my question now – Zebra Jan 18 '11 at 9:16
up vote 1 down vote accepted

To display title of current page you use the_title() template tag.

Related and slightly more specific functions are:

  • get_the_title() that returns title without echoing and can retrieve title of another page/post, given its ID as input;
  • the_title_attribute() that returns a little more cleaned up version (safer to use in link titles without breaking markup and such) and takes arguments in query string format.
share|improve this answer
Thanks alot – Zebra Jan 18 '11 at 9:26
Or maybe even get_query_var('pagename')? – t31os Jan 18 '11 at 16:34
@t31os if I am not mistaken that would be slug and not title. – Rarst Jan 18 '11 at 16:59
Oh yes of course, my bad... – t31os Jan 18 '11 at 18:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.