This is an odd problem that I have never run into before with WordPress.
I have a site, permalinks enabled.
The url can be http://mysite.com/page-name/?anyParamName=testing
then when I use print_r($_GET);
or echo $_GET["anyParamName"]
I get an empty array or nothing respectively.
A pure PHP file works fine so its not a server issue. Does WordPress do anything with rewiring the get params? Really puzzled by this.
4 Answers
For custom parameters you should register them with WordPress:
add_action('init','wpse46108_register_param');
function wpse46108_register_param() {
global $wp;
$wp->add_query_var('anyParamName');
}
Then the value of ‘anyParamName’ can be found with get_query_var
$anyParamNameValue = get_query_var('anyParamName').