WP_Tax_Query::sanitize_relation()publicWP 4.1.0

Sanitizes a 'relation' operator.

Method of the class: WP_Tax_Query{}

No Hooks.

Return

String. Sanitized relation. Either 'AND' or 'OR'.

Usage

$WP_Tax_Query = new WP_Tax_Query();
$WP_Tax_Query->sanitize_relation( $relation );
$relation(string) (required)
Raw relation key from the query argument.

Changelog

Since 4.1.0 Introduced.

WP_Tax_Query::sanitize_relation() code WP 6.5.4

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