0

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

1
  • $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. Commented Jul 7, 2011 at 9:08

4 Answers 4

3

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

1

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

-1

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

-1

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 and acknowledge you have read our privacy policy.

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