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

  • $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. )


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


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


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.

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.