0

Can any one tell me about the following code.

This code is not giving error but not working.

$args = array(
    'cache_results' => false,
    'update_post_meta_cache' => false,
    'update_post_term_cache' => false,

    'post_type' => 'estate_property',
    'post_status' => 'publish',
    'paged' => $pagination,
    'posts_per_page' => $prop_no,
    'meta_key' => $meta_order,
    'orderby' => $order_by,
    'order' => $meta_directions,
    //'meta_query'      => $meta_query,
    'tax_query' => array(
        'relation' => 'AND',
        $categ_array,
        $action_array,
        $city_array,
        $area_array,
        $county_array

    )
);


$features = array();
$features = wpestate_add_feature_to_search_ajax();
$metas = wpestate_convert_meta_to_postin($meta_query);


if (!empty($features)) {
    if (!empty($metas)) {
        $all_ids = array_intersect($metas, $features);
    } else {
        $all_ids = $features;
    }
} else {
    $all_ids = $metas;
}


if (empty($all_ids)) {
    $all_ids[] = 0;
}


$args['post__in'] = $all_ids;


global $keyword;
$keyword = esc_html($_POST['keyword']);

if (!is_numeric($keyword)) {
    $args['meta_query'] = array(
        'relation' => 'OR',
        array(
            'meta_key' => 'taken-by',
            'meta_value' => $keyword,
            'type' => 'CHAR',
            'compare' => 'LIKE'),
        array(
            'meta_key' => 'property-project',
            'meta_value' => $keyword,
            'type' => 'CHAR',
            'compare' => 'LIKE'
        ),
        array(
            'key' => 'post_title',
            'value' => $keyword,
            'type' => 'CHAR',
            'compare' => 'LIKE'
        )
    );
} else {
    $args['meta_query'] = array(
        array(
            'key' => 'ID',
            'value' => $keyword,
            'type' => 'NUMERIC',
            'compare' => '='
        )
    );
}

/*if( !empty($keyword)  ){
 add_filter( 'posts_where', 'wpestate_title_filter', 10, 2 );
}*/

$prop_selection = new Wp_Query($args);
2
  • The one thing that jumps out at me is that it's WP_Query, not Wp_Query. (Also, I have no idea what the wpestate_* functions do.)
    – Pat J
    Commented May 10, 2018 at 13:39
  • WP_Query is also giving the same null result.
    – Mohd Hasan
    Commented May 10, 2018 at 13:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.