Inventory_Presser_Additional_Listings_Pages::modify_query( WP_Query $query )

modify_query


Description Description

Changes the query to satisfy the rule for this listings page


Top ↑

Parameters Parameters

$query

(WP_Query) (Required)


Top ↑

Return Return

(WP_Query)


Top ↑

Source Source

File: includes/class-additional-listings-pages.php

	function modify_query( $query ) {
		$additional_listing = self::get_current_matched_rule( $query );
		if ( ! $additional_listing ) {
			return;
		}

		// found it, require the key & enforce the logic in the rule
		$old = $query->get( 'meta_query', array() );
		$new = self::get_query_meta_array( $additional_listing );

		if ( ! empty( $new ) ) {
			$query->set( 'meta_query', array_merge( $old, $new ) );
		}
		return $query;
	}