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

How can i get a page ID from the Admin backend? I'm saving data into a metabox on a 'Page' post type, and I need to return that data on the page in another area. But $post->ID obviously dose not work... What will work? Thanks

share|improve this question
$post->ID will always work on a post/page edit page. You might have to do 'global $post' depending on where you are using it. But it will always work. – Hameedullah Khan Jul 7 '11 at 9:08

Take a look this page from the codex. When creating a metabox, one of the options is a callback, which when called take a paramater for $post, which is the same as calling global $post ( as a side note, you can still do this in the backend Admin and get all the same variables. )

share|improve this answer
up vote 0 down vote accepted

This is what I needed $_REQUEST['post']

share|improve this answer

Maybe this plugin: http://www.primothemes.com/post/product/wp-show-ids-plugin/ is what you want.

share|improve this answer

are you working with a custom post type for page?

You can always use get_post_meta() in your template to get the post type value and if its not there it doesn't matter.

** EDIT **

Correct me if I'm wrong, but it sounds like you have 2 pages and you're trying to get the information in a meta box from one and load it in to the other?

If so the best way is to get set a custom field up to store a number which would be the post ID, then in the front end call it out.

The other options is to set up a custom post type with a specific meta box set up to build a list of 'Pages' then you can select from to then pull in a meta value associated with it.

share|improve this answer

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.