Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mu-plugin file that replaces the content of a page with an example demonstrating add_query_arg() does not urlencode parameters.
<?php
add_action( 'the_content', 'test_add_query_arg_output' );
function test_add_query_arg_output( $content ) {
return add_query_arg(
array(
'var_key' => 'key_value',
'another_var' => 'My Value'
),
home_url()
);
// value returned is
// http://www.example.com?var_key=key_value&another_var=My Value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.