WooCommerce Code Reference

WC_Object_Query
in package

Abstract WC Object Query Class

Extended by classes to provide a query abstraction layer for safe object searching.

Tags
version
3.1.0

Table of Contents

$query_vars  : array<string|int, mixed>
Stores query data.
__construct()  : mixed
Create a new query.
get()  : mixed
Get the value of a query variable.
get_query_vars()  : array<string|int, mixed>
Get the current query vars.
set()  : mixed
Set a query variable.
get_default_query_vars()  : array<string|int, mixed>
Get the default allowed query vars.

Properties

Methods

__construct()

Create a new query.

public __construct([array<string|int, mixed> $args = array() ]) : mixed
Parameters
$args : array<string|int, mixed> = array()

Criteria to query on in a format similar to WP_Query.

Return values
mixed

get()

Get the value of a query variable.

public get(string $query_var[, mixed $default = '' ]) : mixed
Parameters
$query_var : string

Query variable to get value for.

$default : mixed = ''

Default value if query variable is not set.

Return values
mixedQuery variable value if set, otherwise default.

set()

Set a query variable.

public set(string $query_var, mixed $value) : mixed
Parameters
$query_var : string

Query variable to set.

$value : mixed

Value to set for query variable.

Return values
mixed