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

Filter callback that changes a query’s meta_query value if the meta_query does not already contain the provided $key.


Parameters Parameters

$meta_query

(array) (Required) The meta_query member of a WP_Query, retrieved with WP_Query->get(‘meta_query’).

$key

(string) (Required)

$value

(string) (Required)

$compare

(string) (Required)

$type

(string) (Required)


Top ↑

Return Return

(array) The modified $meta_query array


Top ↑

Source Source

File: inventory-presser.php

		 */
		public function mark_vehicles_for_sale_during_insertion( $post_ID, $post, $update ) {
			if ( $update ) {
				// Abort, we only want to affect insertions.
				return;
			}

			// Does the vehicle already have a term in the Availabilities taxonomy?
			$terms = wp_get_object_terms( $post_ID, 'availability' );
			if ( ! empty( $terms ) && is_array( $terms ) ) {
				// Yes, abort.
				return;
			}