init.php
public function ajax_find_posts() {
		if (
			defined( 'DOING_AJAX' )
			&& DOING_AJAX
			&& isset( $_POST['cmb2_attached_search'], $_POST['retrieved'], $_POST['action'], $_POST['search_types'] )
			&& 'find_posts' == $_POST['action']
			&& ! empty( $_POST['search_types'] )
		) {
			// This is not working until we fix the user query bit.
			if ( ! empty( $_POST['query_users'] ) ) {
				add_action( 'pre_get_users', array( $this, 'modify_query' ) );
			} else {
				add_action( 'pre_get_posts', array( $this, 'modify_query' ) );
			}
		}
	}
public function ajax_find_posts() {
		if (
			defined( 'DOING_AJAX' )
			&& DOING_AJAX
			&& isset( $_POST['cmb2_attached_search'], $_POST['retrieved'], $_POST['action'], $_POST['search_types'] )
			&& 'find_posts' == $_POST['action']
			&& ! empty( $_POST['search_types'] )
		) {
			// This is not working until we fix the user query bit.
			if ( ! empty( $_POST['query_users'] ) ) {
				add_action( 'pre_get_users', array( $this, 'modify_query' ) );
			} else {
				add_action( 'pre_get_posts', array( $this, 'modify_query' ) );
			}
		}
	}
public function ajax_find_posts ( ) { if ( defined ( 'DOING_AJAX' ) && DOING_AJAX && isset ( $ _POST [ 'cmb2_attached_search' ] , $ _POST [ 'retrieved' ] , $ _POST [ 'action' ] , $ _POST [ 'search_types' ] ) && 'find_posts' == $ _POST [ 'action' ] && ! empty ( $ _POST [ 'search_types' ] ) ) { // This is not working until we fix the user query bit. if ( ! empty ( $ _POST [ 'query_users' ] ) ) { add_action ( 'pre_get_users' , array ( $ this , 'modify_query' ) ) ; } else { add_action ( 'pre_get_posts' , array ( $ this , 'modify_query' ) ) ; } } }
Check to see if we have a post type set and, if so, add the
pre_get_posts action to set the queried post type

@since  1.2.4


@return void
Check to see if we have a post type set and if so add the pre_get_posts action to set the queried post type