WP_Tax_Query::sanitize_relation( string $relation )

Sanitize a ‘relation’ operator.

Parameters

$relation

(string) (Required) Raw relation key from the query argument.

Return

(string) Sanitized relation ('AND' or 'OR').

Source

File: wp-includes/class-wp-tax-query.php

public function sanitize_relation( $relation ) {
		if ( 'OR' === strtoupper( $relation ) ) {
			return 'OR';
		} else {
			return 'AND';
		}
	}

Changelog

Version Description
4.1.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_tax_query/sanitize_relation