[wp-hackers] $postnow?
Mike Schinkel
mikeschinkel at newclarity.net
Wed Sep 22 05:58:32 UTC 2010
Here's another one that I've probably missed though not for lack of looking, hoping you can help.
We've got $typenow to tell us what post_type we are currently acting on, $pagenow to tell us what the current .PHP page is and $taxnow to tell what taxonomy we are working with but as far as I can tell there's no equivalent way to find the post ID we are currently working with.
I'm finding it very hard to write robust code that gets it right 100% of the time because it appears it can be at least any one of the following and it's hard to get all of the contexts completely right:
$_GET['post']
$_GET['post_id']
$_GET['page_id']
$_POST['page_id']
$_POST['page_ID']
And there may be other ways I've missed. Am I overlooking something obvious? Is there some way to determine the $post->ID that I can depend on?
Thanks in advance.
-Mike
More information about the wp-hackers
mailing list