[wp-hackers] get post Id from url (when mod_Rewrite enabled)

Otto otto at ottodestruct.com
Thu Dec 27 14:42:54 GMT 2007


On 12/27/07, Ozh <ozh at planetozh.com> wrote:
> > When no url rewriting is used, I can grab the post id using $_GET['p'].
> > However, when URL , rewriting is in use, and I use the post_name slug
> > line inside the link, I can't grab the post id at all. I tried to play
> > with the WP_rewrite class, and nothing. I also did a print_r($_GET) and
> > no slug shows up (thinking I'll do a MySQL select to extract my id).
>
> What about global $id ?

Can't you also just call get_query_var('p')?


More information about the wp-hackers mailing list