WC_Query::get_main_meta_query
Get the meta query which was used by the main query.
Метод класса: WC_Query{}
Хуков нет.
Возвращает
array.
Использование
$result = WC_Query::get_main_meta_query();
Код WC_Query::get_main_meta_query() WC Query::get main meta query WC 11.3.0
public static function get_main_meta_query() {
// PHPStan infers $product_query as non-nullable from other call sites. See https://github.com/woocommerce/woocommerce/pull/64360#issuecomment-4360066970.
// @phpstan-ignore-next-line isset.property See above.
if ( ! isset( self::$product_query ) ) {
return array();
}
$args = self::$product_query->query_vars;
$meta_query = isset( $args['meta_query'] ) ? $args['meta_query'] : array();
return $meta_query;
}