Inventory_Presser_Plugin::meta_query_contains_clause( array $meta_query, string $key,  $value,  $compare,  $type )

meta_query_contains_clause


Description Description

Does a meta_query already contain a clause?


Top ↑

Parameters Parameters

$meta_query

(array) (Required) The array return value of WP_Query->get('meta_query')

$key

(string) (Required) The meta key to search for


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: inventory-presser.php

	public static function meta_query_contains_clause( $meta_query, $key, $value, $compare, $type )
	{
		if( is_array( $meta_query ) )
		{
			if( isset( $meta_query['key'] )
				&& isset( $meta_query['value'] )
				&& isset( $meta_query['compare'] )
				&& isset( $meta_query['type'] ) )
			{
				return $meta_query['key'] == $key
					&& $meta_query['value'] == $value
					&& $meta_query['compare'] == $compare
					&& $meta_query['type'] == $type;
			}

			foreach( $meta_query as $another )
			{
				return self::meta_query_contains_clause( $another, $key, $value, $compare, $type );
			}
		}
		return false;
	}