[wp-hackers] problems with wpquery

Khaleel Abdul Karim webmaster887 at gmail.com
Tue May 11 03:50:50 UTC 2010


I have resolved it myself by adding

*$wp_query->get_queried_object_id();
*
with the code. Now it's working fine . Thanks for everyones' effert :-)

On Tue, May 11, 2010 at 8:34 AM, Glenn Ansley <glenn at glennansley.com> wrote:

> 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
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
~~~~~~~~~~~~~~~~~~
http://khaleel.isgreat.org
Khaleel Abdul Karim
Thazhathuveedu
Erumely


More information about the wp-hackers mailing list