Title: WordPress Custom meta_query
Last modified: August 20, 2016

---

# WordPress Custom meta_query

 *  [yokowasis](https://wordpress.org/support/users/yokowasis/)
 * (@yokowasis)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/wordpress-custom-meta_query/)
 * I have got a problem using meta_query.
    For some reasons WordPress makes my machine
   crash when dealing with more than 8 meta_query.
 * To make things clear, this is my meta_query variable :
 *     ```
       Array
       (
           [relation] => AND
           [0] => Array
               (
                   [key] => price
                   [value] => Array
                       (
                           [0] => 0
                           [1] => 899
                       )
   
                   [type] => numeric
                   [compare] => BETWEEN
               )
   
           [1] => Array
               (
                   [key] => laptops_brand
                   [value] => Array
                       (
                           [0] => Acer
                           [1] => Dell
                       )
   
                   [compare] => IN
               )
   
           [2] => Array
               (
                   [key] => laptops_model
                   [value] =>
                   [compare] => IN
               )
   
           [3] => Array
               (
                   [key] => laptops_screen_size
                   [value] => Array
                       (
                           [0] => 0
                           [1] => 14
                       )
   
                   [type] => numeric
                   [compare] => BETWEEN
               )
   
           [4] => Array
               (
                   [key] => laptops_max_screen_resolution
                   [value] => Array
                       (
                           [0] => 1366 x 768
                       )
   
                   [compare] => IN
               )
   
           [5] => Array
               (
                   [key] => laptops_processor
                   [value] => Array
                       (
                           [0] => AMD C60
                           [1] => Intel Core i5
                       )
   
                   [compare] => IN
               )
   
           [6] => Array
               (
                   [key] => laptops_ram
                   [value] => Array
                       (
                           [0] => 0
                           [1] => 4
                       )
   
                   [type] => numeric
                   [compare] => BETWEEN
               )
   
           [7] => Array
               (
                   [key] => laptops_hard_drive
                   [value] => Array
                       (
                           [0] => 0
                           [1] => 500
                       )
   
                   [type] => numeric
                   [compare] => BETWEEN
               )
   
           [8] => Array
               (
                   [key] => laptops_graphic_coprosesor
                   [value] => Array
                       (
                           [0] => ATI RADEON HD 4300
                           [1] => Intel Core i3
                       )
   
                   [compare] => IN
               )
   
           [9] => Array
               (
                   [key] => laptops_graphic_card_ram_size
                   [value] => Array
                       (
                           [0] => 0
                           [1] => 512
                       )
   
                   [type] => numeric
                   [compare] => BETWEEN
               )
   
           [10] => Array
               (
                   [key] => laptops_reported_battery_live
                   [value] => Array
                       (
                           [0] => 0
                           [1] => 4
                       )
   
                   [type] => numeric
                   [compare] => BETWEEN
               )
   
       )
       ```
   
 * When using above arrays, the wordpress crash which leads to crash my PC and I
   need to hard reset my PC.
 * But when I put this array
 *     ```
       Array
       (
           [relation] => AND
           [0] => Array
               (
                   [key] => price
                   [value] => Array
                       (
                           [0] => 0
                           [1] => 899
                       )
   
                   [type] => numeric
                   [compare] => BETWEEN
               )
   
           [1] => Array
               (
                   [key] => laptops_brand
                   [value] => Array
                       (
                           [0] => Acer
                           [1] => Dell
                       )
   
                   [compare] => IN
               )
   
           [2] => Array
               (
                   [key] => laptops_screen_size
                   [value] => Array
                       (
                           [0] => 0
                           [1] => 14
                       )
   
                   [type] => numeric
                   [compare] => BETWEEN
               )
   
           [3] => Array
               (
                   [key] => laptops_processor
                   [value] => Array
                       (
                           [0] => AMD C60
                           [1] => Intel Core i5
                       )
   
                   [compare] => IN
               )
   
           [4] => Array
               (
                   [key] => laptops_ram
                   [value] => Array
                       (
                           [0] => 0
                           [1] => 4
                       )
   
                   [type] => numeric
                   [compare] => BETWEEN
               )
   
           [5] => Array
               (
                   [key] => laptops_hard_drive
                   [value] => Array
                       (
                           [0] => 0
                           [1] => 500
                       )
   
                   [type] => numeric
                   [compare] => BETWEEN
               )
   
           [6] => Array
               (
                   [key] => laptops_graphic_coprosesor
                   [value] => Array
                       (
                           [0] => ATI RADEON HD 4300
                           [1] => Intel Core i3
                       )
   
                   [compare] => IN
               )
   
           [7] => Array
               (
                   [key] => laptops_reported_battery_live
                   [value] => Array
                       (
                           [0] => 0
                           [1] => 4
                       )
   
                   [type] => numeric
                   [compare] => BETWEEN
               )
   
       )
       ```
   
 * It works flawlessly.
 * Here is the WP_Query Variable
 *     ```
       $q = new WP_Query(
       	array(
       		"post_type" => $_GET['type'],
       		"posts_per_page" => 10,
       		"paged" => $_GET["paged"],
       		"meta_query" => $meta,
       	)
       );
       ```
   
 * Any idea what caused this ?
 * Thanks
 * I am open to any idea to achieve the same results, even if it has to deal with
   mySQL Query using global $wpdb.
 * _[ mod note – follow-up post pasted in above & deleted along with subsequent 
   bump to get topic onto the no-replies list ]_

The topic ‘WordPress Custom meta_query’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [yokowasis](https://wordpress.org/support/users/yokowasis/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/wordpress-custom-meta_query/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
