tribe_get_global_query_object()
Grabs the $wp_query global in a safe way with some fallbacks that help prevent fatal errors on sites where themes or other plugins directly manipulate the $wp_query global.
Return
(WP_Query) The $wp_query, the $wp_the_query if $wp_query empty, null otherwise.
Source
File: src/functions/utils.php
function tribe_get_global_query_object() {
global $wp_query;
global $wp_the_query;
if ( ! empty( $wp_query ) ) {
return $wp_query;
}
if ( ! empty( $wp_the_query ) ) {
return $wp_the_query;
}
return null;
}
Changelog
| Version | Description |
|---|---|
| 4.7.8 | Introduced. |