wp_Query with 4 post meta feald arguments gives 500 internal server error

Question

I am creating a custom plugin to search for custom post type provided with 4 meta field arguments.
I am using wp_Query() to fetch the search results. My Query string is.

            $args = array(
            'update_post_meta_cache' => false,
            'cache_results' => false,
            'post_type' => 'caravans',
            'meta_query' => array(
                'relation' => 'OR',
                array(
                    'key' => 'caravan_used_new',
                    'value' => $used,
                    'compare'=>'like',
                ),
                array(
                    'key' => 'caravan_or_motorhome',
                    'value' => $type,
                    'compare'=>'like',
                ),
                array(
                    'key' => 'caravan_berth',
                    'value' => $bearth,
                    'compare'=>'like',
                ),
                array(
                    'key' => 'caravan_make',
                    'value' => $make,
                    'compare'=>'like',
                ),
            )
        );
        if(!empty($key)){
            $wp_query = new WP_Query("s=$key", $args);
        }else{
            $wp_query = new WP_Query($args);
        }

Now it is working good if I put only three meta_Query arguments when I make it to 4 its start crashing and all I see in 500 internal server error. Am I doing something wrong or meta_query has its own limits?

0
, , Abhimanue Tamang 7 years 0 Answers 92 views 0

Leave an answer