Inventory_Presser_Plugin::meta_query_contains_key( array $meta_query, string $key )

meta_query_contains_key


Description Description

Does a query's meta_query contain a specific key?


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|null)


Top ↑

Source Source

File: inventory-presser.php

	function meta_query_contains_key( $meta_query, $key )
	{
		if( is_array( $meta_query ) )
		{
			if( isset( $meta_query['key'] ) )
			{
				return $meta_query['key'] == $key;
			}

			foreach( $meta_query as $another )
			{
				return $this->meta_query_contains_key( $another, $key );
			}
		}
		return null;
	}