PHP WordPress - Build Query String with http_build_query

<?php $args = array ( 'filter' => array ( 'meta_query' => array ( 'relation' => 'AND', array ( 'key' => 'color', 'value' => 'blue', 'compare' => '=', ), array ( 'key' => 'test', 'value' => 'testing', 'compare' => '=', ), ), ), ); $field_string = http_build_query( $args ); echo urldecode( $field_string ); // filter[meta_query][relation]=AND&filter[meta_query][0][key]=color&filter[meta_query][0][value]=blue&filter[meta_query][0][compare]==&filter[meta_query][1][key]=test&filter[meta_query][1][value]=testing&filter[meta_query][1][compare]==

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.