• Resolved FFPR

    (@ffpr)


    Hi there,

    in my theme’s functions.php I use

    function add_custom_query_vars($vars) {
      $vars[] = "tdhm";
      $vars[] = "tdht";
      return $vars;
    }
    add_filter('query_vars', 'add_custom_query_vars');

    to register the two custom vars “tdhm” and “tdht”.

    When I try to access them lateron fromn my page’s template

    if(isset($wp_query->query_vars['tdhm'])) {
      $email = urldecode($wp_query->query_vars['tdhm']);
    }
    
    if(isset($wp_query->query_vars['tdht'])) {
      $token = urldecode($wp_query->query_vars['tdht']);
    }

    they are always empty.

    I looked up the results of var_dump($wp_query->query_vars); and they are nowhere to be found. What am I doing wrong? I could not find anything on this issue within Codex and I have used this function before in other WordPress versions without any problems.

    Best regards, Mathias

Viewing 1 replies (of 1 total)
  • Thread Starter FFPR

    (@ffpr)

    it was actually more of a combined varianble / routing problem. I will open up another thread for that.

Viewing 1 replies (of 1 total)
  • The topic ‘query_vars hook: custom vars not registering’ is closed to new replies.