[wp-hackers] get_queried_object_id

John Blackbourn johnbillion+wp at gmail.com
Wed Jan 29 22:49:57 UTC 2014


get_queried_object() and get_queried_object_id() only return a value when
one of the following are true:

 * is_post_type_archive()
 * is_singular()
 * is_tax()/is_tag()/is_category()
 * is_author()

In any other situation, there is no queried object.

John


On 29 January 2014 22:41, Haluk Karamete <halukkaramete at gmail.com> wrote:

> In what situations does the queried_object_id becomes not available?
>
> In query.php, we have this;
>
> 3325        function get_queried_object_id() {
> 3326                $this->get_queried_object();
> 3327
> 3328                if ( isset($this->queried_object_id) ) {
> 3329                        return $this->queried_object_id;
> 3330                }
> 3331
> 3332                return 0;
> 3333        }
> 3334
>
> So under which circumstances does this return 0?
>
> thanks
> _______________________________________________
> 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