Tribe__Context::query_method( $methods, mixed $default )

Reads the value from one or more global WP_Query object methods.


Parameters

$query_vars

(array) (Required) The list of query methods to call, in order.

$default

(mixed) (Required) The default value to return if no method was defined on the global WP_Query object.


Top ↑

Return

(mixed) The first valid value found or the default value.


Top ↑

Source

File: src/Tribe/Context.php

	public function query_method( $methods, $default ) {
		global $wp_query;
		$found = $default;

		foreach ( $methods as $method ) {
			$this_value = $wp_query instanceof WP_Query && method_exists( $wp_query, $method )
				? call_user_func( [ $wp_query, $method ] )
				: static::NOT_FOUND;

			if ( static::NOT_FOUND !== $this_value ) {
				return $this_value;
			}
		}

		return $found;
	}

Top ↑

Changelog

Changelog
Version Description
4.9.20 Introduced.