[wp-hackers] problems with wpquery

Glenn Ansley glenn at glennansley.com
Tue May 11 03:04:15 UTC 2010


Where is this code being executed? If it's attached to a hook before the
template_redirect action you're not going to get that property returned.

Glenn Ansley
http://fullthrottledevelopment.com
http://twitter.com/glennansley

On Mon, May 10, 2010 at 10:52 PM, Mark E <mark at simplercomputing.net> wrote:

>
>
> Khaleel Abdul Karim wrote:
>
>>   *     global $wp,$wp_query;
>>        $wp->parse_request();
>>        $wp->query_posts();
>>        print_r($wp_query->queried_object_id);*
>>
>> I have tried this code to get id of a queried post/page/cat etc. But *
>> $wp_query->queried_object_id* returns me a NULL value. Any solution.
>> Thanks in advance.
>>
>
> You can dump the $wp_query array to see what's in it, look for the field
> you want, and go from there. Dump it like this:
>
> var_dump($wp_query);
>
> Then load a page and view the HMTL source of the page to see the dumped
> output formated with line breaks (easier to read that way).
>
> Mark
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list