fork download
  1. <?php
  2.  
  3. $args = array(
  4. 'post_type' => 'events',
  5. 'meta_query' => array(
  6. 'relation' => 'AND',
  7. 'key' => 'events_start-date',
  8. 'value' => date('YYYY-mm-dd'),
  9. 'type' => 'CHAR',
  10. 'compare' => '>='
  11. )
  12. )
  13. );
  14.  
  15. $another = array('tax_query' => array(
  16. 'relation' => 'and',
  17. 'taxonomy' => 'type',
  18. 'field' => 'slug',
  19. 'terms' => 'national'
  20. )
  21. ));
  22.  
  23. $merged = array_merge($args, $another);
  24.  
  25. var_dump($merged);
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
array(3) {
  ["post_type"]=>
  string(6) "events"
  ["meta_query"]=>
  array(2) {
    ["relation"]=>
    string(3) "AND"
    [0]=>
    array(4) {
      ["key"]=>
      string(17) "events_start-date"
      ["value"]=>
      string(26) "2013201320132013-0606-0202"
      ["type"]=>
      string(4) "CHAR"
      ["compare"]=>
      string(2) ">="
    }
  }
  ["tax_query"]=>
  array(2) {
    ["relation"]=>
    string(3) "and"
    [0]=>
    array(3) {
      ["taxonomy"]=>
      string(4) "type"
      ["field"]=>
      string(4) "slug"
      ["terms"]=>
      string(8) "national"
    }
  }
}