Wallmander\ElasticsearchIndexer\Model\Query::applyWpQuery PHP Method

applyWpQuery() public method

public applyWpQuery ( WP_Query $wpQuery )
$wpQuery WP_Query
    public function applyWpQuery(WP_Query $wpQuery)
    {
        $this->wp_query = $wpQuery;
        $this->formatArgs($wpQuery);
    }

Usage Example

/**
 * @param null|WP_Query $wpQuery
 *
 * @return \Wallmander\ElasticsearchIndexer\Model\Query
 */
function es_query($wpQuery = null)
{
    $esq = new Query();
    if ($wpQuery instanceof WP_Query) {
        $esq->applyWpQuery($wpQuery);
    }
    return $esq;
}