WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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',
                    'key' => 'caravan_used_new',
                    'value' => $used,
                    'key' => 'caravan_or_motorhome',
                    'value' => $type,
                    'key' => 'caravan_berth',
                    'value' => $bearth,
                    'key' => 'caravan_make',
                    'value' => $make,
            $wp_query = new WP_Query("s=$key", $args);
            $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?

share|improve this question

I found solution to my problem by replicating the whole setup to my local server. Everything worked fine query executed normally. And the bug was memory allocated for PHP execution which i come to know by comparing the local and live server. So for that I declared two lines in the header part of the file.

ini_set("memory_limit", "1024M");
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.