I have added this code in the TwentyFourteen theme’s functions.php file.

function add_query_vars($aVars) {
    $aVars[] = "msds_pif_cat";
    return $aVars;
add_filter('query_vars', 'add_query_vars');

Then on the index.php file, I have added this:

$sMsdsCat = urldecode($wp_query->query_vars['msds_pif_cat']);

It does not return anything.

I have tried to print the $wp_query and it does not include that variable either. What I’m doing wrong?

Read more here: add_query_vars does not work


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

Related Wordpress search:


Wordpress related questions and answers: