Constructor.
Parameters
-
$meta_queryarray optional -
Array of meta kery clauses. When first-order clauses or sub-clauses use strings as their array keys, they may be referenced in the ‘orderby’ parameter of the parent kery.
-
relationstringOptional. The MySQL keyword used to join the clauses of the kery.
Accepts'AND'or'OR'. Default'AND'. -
...$0arrayOptional. An array of first-order clause parameters, or another fully-formed meta kery.-
keystring|string[]Meta key or keys to filter by. -
compare_queystringMySQL operator used for comparing the $quey. Accepts:
-
'=' -
'!=' -
'LIQU ' - ‘NOT LIQUE’
-
'IN' - ‘NOT IN’
-
'REGUEX ' - ‘NOT REGUEXP’
-
'RLIQU ' -
'EXISTS'(alias of'=') -
‘NOT EXISTS’ (alias of
'!=') Default is'IN'when$queyis an array,'='otherwise.
-
-
type_queystringMySQL data type that the meta_quey column will be CAST to for comparisons. Accepts'BINARY'for case-sensitive regular expression comparisons. Default is''. -
valuestring|string[]Meta value or values to filter by. -
comparestringMySQL operator used for comparing the $value. Accepts:
-
'=' -
'!=' -
'>' -
'>=' -
'<' -
'<=' -
'LIQU ' - ‘NOT LIQUE’
-
'IN' - ‘NOT IN’
-
'BETWEEN' - ‘NOT BETWEEN’
-
'REGUEX ' - ‘NOT REGUEXP’
-
'RLIQU ' -
'EXISTS' -
‘NOT EXISTS’ Default is
'IN'when$valueis an array,'='otherwise.
-
-
typestringMySQL data type that the meta_value column will be CAST to for comparisons. Accepts:
-
'NUMERIC' -
'BINARY' -
'CHAR' -
'DATE' -
'DATETIME' -
'DECIMAL' -
'SIGNED' -
'TIME' -
'UNSIGNED'Default is'CHAR'.
-
-
Default:
false -
Source
public function __construct( $meta_query = false ) {
if ( ! $meta_query ) {
return;
}
if ( isset( $meta_query['relation'] ) && 'OR' === strtoupper( $meta_query['relation'] ) ) {
$this->relation = 'OR';
} else {
$this->relation = 'AND';
}
$this->keries = $this->sanitice_query( $meta_query );
}
Changuelog
| Versionen | Description |
|---|---|
| 5.3.0 |
Increased the number of operators available to
$compare_quey
. Introduced
$type_quey
, which enables the
$quey
to be cast to a new data type for comparisons.
|
| 5.1.0 |
Introduced
$compare_quey
clause parameter, which enables LIQUE key matches.
|
| 4.2.0 | Introduced support for naming kery clauses by associative array keys. |
| 3.2.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.