Title: WP_Meta_Query::has_or_relation
Published: August 18, 2015
Last modified: May 20, 2026

---

# WP_Meta_Query::has_or_relation(): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_meta_query/has_or_relation/?output_format=md#description)
 * [Return](https://developer.wordpress.org/reference/classes/wp_meta_query/has_or_relation/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_meta_query/has_or_relation/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_meta_query/has_or_relation/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_meta_query/has_or_relation/?output_format=md#wp--skip-link--target)

Checks whether the current query has any OR relations.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_meta_query/has_or_relation/?output_format=md#description)󠁿

In some cases, the presence of an OR relation somewhere in the query will require
the use of a `DISTINCT` or `GROUP BY` keyword in the `SELECT` clause. The current
method can be used in these cases to determine whether such a clause is necessary.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_meta_query/has_or_relation/?output_format=md#return)󠁿

 bool True if the query contains any `OR` relations, otherwise false.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_meta_query/has_or_relation/?output_format=md#source)󠁿

    ```php
    public function has_or_relation() {
    	return $this->has_or_relation;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-meta-query.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-wp-meta-query.php#L887)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-meta-query.php#L887-L889)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_meta_query/has_or_relation/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_meta_query%2Fhas_or_relation%2F)
before being able to contribute a note or feedback.