I want to add keys to this WP_Query $args
array. They have nested arrays and for post-format the terms
has to have an value array without keys to work. However when adding a key it autocreates a key '0' => 'value'
.
PHP:
$args = array(
'hierarchical' => true,
'posts_per_page' => $posts_per_page,
);
$post_formats_query = array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array('post-format-'. $format_value);
);
$args['tax_query']=$post_formats_query; //this seems to create unwanted key
Var dump:
array (
'hierarchical' => true,
'posts_per_page' => '-1',
'post_type' => 'post',
'tax_query' =>
array (
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' =>
array (
0 => 'post-format-gallery', //I WANT TO REMOVE THIS KEY
),
),
'category_name' => NULL,
)