Url : https://example.com/testing-tweet?somevar=“testData”

I want to get the somevar value on the url using $_GET.

print_r($_GET);

But It always return an empty array. Since the site is build with wordpress, I also tried the get_query_var of wordpress.

function add_query_vars_filter( $vars ){
  $vars[] = "somevar";
  return $vars;
}
add_filter( 'query_vars', 'add_query_vars_filter' );

And on the page.php or custom page template.

var_dump(get_query_var( 'test_my_var' ));

It return empty string. I also tried to disable all the plugin on the site and remove all the custom query var that is existing but still no luck any idea? Thanks!

Read more here: Cant parse the data on GET parameter on a URL wordpress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: