title: How to get the query string url in WordPress?
body: <p>I created a custom post template that displays the post according to the taxonomy and terms.</p>
  
  <p>The url that i created looks like this : <a href="http://example.com/courses/course-title/?type=english-test&amp;term=new" rel="nofollow">http://example.com/courses/course-title/?type=english-test&amp;term=new</a></p>
  
  <p>There is an example <a href="https://developer.wordpress.org/reference/functions/add_query_arg/" rel="nofollow">here</a> add_query_arg() but it seems that it is retrieving the values statically</p>
  
  <pre><code>// This would output '/client/?s=word&amp;foo=bar'
     echo esc_url( add_query_arg( 'foo', 'bar' ) );
  
  // This would output '/client/?s=word&amp;foo=bar&amp;baz=tiny'
  $arr_params = array( 'foo' =&gt; 'bar', 'baz' =&gt; 'tiny' );
  echo esc_url( add_query_arg( $arr_params ) );
  </code></pre>
  
  <p><strong>Question:</strong> How can i get the <strong>english-test</strong> and <strong>new</strong> from the url and store them to a variable?</p>
  
  <p>Any help is appreciated. Thanks</p>