Discussion:
get_queried_object_id
Haluk Karamete
2014-01-29 22:41:42 UTC
Permalink
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
John Blackbourn
2014-01-29 22:49:57 UTC
Permalink
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
Post by 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
http://lists.automattic.com/mailman/listinfo/wp-hackers
Continue reading on narkive:
Loading...