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

In this question contents of another page can be rendered to another page, but how do I do it for the title too?

Can I just go $content = apply_filters('the_title', $post->post_content);?

But what do I add at the second argument? From how it looks like, it's an array right?

Which one stores the actual title of the page?

share|improve this question
up vote 0 down vote accepted

Use get_the_title():

$page  = get_page_by_title( 'About' );
$title = get_the_title( $page );

You could also use $page->post_title, but get_the_title() will let plugins access the title, which sometimes quite useful.

share|improve this answer
thank you for taking the time to answer :) but I am embedding a page to another page. so it's like a page within a page. but your answer is helpful, may not be directly to what I wanted but I might try $post->post_title. Thanks! – user2128576 Jun 9 '13 at 23:30
@user2128576 This works with any post object (pages are just special posts). I made an edit to my answer to make that more clear. – toscho Jun 9 '13 at 23:34
Thanks! It Worked! – user2128576 Jun 9 '13 at 23:50
Sir! I have one quick followup question. is there a way to get page using id? instead of title? Since the page I am embedding can change title anytime. by Id? – user2128576 Jun 9 '13 at 23:54
@user2128576 get_page( 123 ); or get_post( 123 );. Both do the same, but get_page() is now deprecated, so use get_post(). – toscho Jun 9 '13 at 23:55

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.