WP_Tax_Query::sanitize_relation() WordPress Method

The WP_Tax_Query::sanitize_relation() method is used to set the correct operator for the given relation. This is used internally by the class when creating SQL queries.

WP_Tax_Query::sanitize_relation( string $relation ) #

Sanitize a ‘relation’ operator.


Parameters

$relation

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


Top ↑

Return

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


Top ↑

Source

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

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


Top ↑

Changelog

Changelog
VersionDescription
4.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.