Skip to content

Instantly share code, notes, and snippets.

@salcode
Created December 9, 2014 03:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salcode/a43940a2ab9b858f317a to your computer and use it in GitHub Desktop.
Save salcode/a43940a2ab9b858f317a to your computer and use it in GitHub Desktop.
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