W3cubDocs

/WordPress

WP_Date_Query::sanitize_relation( string $relation ): string

Sanitizes a ‘relation’ operator.

Parameters

$relationstringrequired
Raw relation key from the query argument.

Return

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

Source

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

Changelog

Version Description
6.0.3 Introduced.

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