D
D
Dmitry Podbolotov2019-02-16 21:06:07
WordPress
Dmitry Podbolotov, 2019-02-16 21:06:07

Why is the variable not added to query_vars?

add_filter('query_vars', 'success_query_vars');
function success_query_vars($vars)
{
    $vars[] .= 'my_success';
    return $vars;
}

add_action('parse_request', 'success_parse_request');
function success_parse_request($wp)
{
    if (array_key_exists('my_success', $wp->query_vars)) { /* не заходит сюда */ }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anatoly, 2019-02-17
@Tolly

query_vars - what is this hook? Mine? It works, have you checked?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question