0

I have created a "News" Page and have switched my posts-page to that Page. Now Posts show up under that Page, as desired.

The problem is I'm trying to access the core Page to pull out some information. On any other Page I could look to $post but in this setup, with blog posts being present, that variable is otherwise taken.

How do I reference the underlying Page object?

1
1

You can get the ID of the front page via get_option( 'page_on_front' ). (See also: WordPress option reference.)

From there, you can query the page object via get_post():

$frontpage = get_post( get_option( 'page_on_front' ) );

Then the content is in the $frontpage object:

$content = $frontpage->post_content;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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