Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

MP_Searches::_getIDLeads( int|string $leads_post_type, array|null $searches = null )

Get IDs for update.


Parameters Parameters

$leads_post_type

(int|string) (Required) post type

$searches

(array|null) (Optional) searches

Default value: null


Top ↑

Return Return

(array) Leads to update.

  • 'id'
    (string) post id


Top ↑

Source Source

File: mortgage-platform/Inc/MP_Searches.php

	private function _getIDLeads( $leads_post_type, $searches = null ) {

		$found = false;
		$leads_update = wp_cache_get($leads_post_type, MortgagePlatform::$domain, false, $found);
		if(!$found){
			$leads = new \WP_Query(
				array(
					'post_type'      => $leads_post_type,
					'posts_per_page' => - 1,
				)
			);
			$leads_update = array();

			if ( $leads->have_posts() ) {
				while ( $leads->have_posts() ) {
					$leads->the_post();

					$lead_data = $this->_getLeadData( $leads->post->ID );

					if ( MortgagePlatform::$abandoned_lead === $leads_post_type ) {
						$leads_update = $this->_getAboundedLeadstoUpdate( $leads->post->ID, $lead_data, $searches, $leads_update );
					} else {
						$leads_update = $this->_getLeadstoUpdate( $leads->post->ID, $lead_data, $leads_update );
					}
				}
			}

			wp_reset_postdata();
			wp_cache_set($leads_post_type, $leads_update, MortgagePlatform::$domain, WEEK_IN_SECONDS);
		}

		return $leads_update;

	}