How to add multiple custom URL variables?

I pretty sure this filter lets you add an array of variables. I’ve not tested this:

function add_custom_query_vars( $vars ){
  $vars[] = "variable1";
  $vars[] = "variable2";
  $vars[] = "variable3";
  //... etc
  return $vars;
}

add_filter( 'query_vars', 'add_custom_query_vars' );

Or another way of doing it would be to do this:

function add_custom_query_vars( $vars ){
  array_push($vars, "variable1", "variable2", "variable3");
  return $vars;
}

add_filter( 'query_vars', 'add_custom_query_vars' );

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)