get_queried_object_id

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

get_queried_object_id

Haluk Karamete
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
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: get_queried_object_id

John Blackbourn
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 <[hidden email]> 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
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers