On this page
WP_Tax_Query::sanitize_relation( string $relation ): string
Sanitizes a ‘relation’ operator.
Parameters
$relationstring Required-
Raw relation key from the query argument.
Return
string Sanitized relation ('AND' or 'OR').
Source
File: wp-includes/class-wp-tax-query.php. View all references
public function sanitize_relation( $relation ) {
if ( 'OR' === strtoupper( $relation ) ) {
return 'OR';
} else {
return 'AND';
}
}
Related
Used By
| Used By | Description |
|---|---|
| WP_Tax_Query::sanitize_query() wp-includes/class-wp-tax-query.php | Ensures the ‘tax_query’ argument passed to the class constructor is well-formed. |
| WP_Tax_Query::__construct() wp-includes/class-wp-tax-query.php | Constructor. |
Changelog
| Version | Description |
|---|---|
| 4.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_tax_query/sanitize_relation