我很确定这个过滤器允许您添加变量数组。我没有测试过:
function add_custom_query_vars( $vars ){
$vars[] = "variable1";
$vars[] = "variable2";
$vars[] = "variable3";
//... etc
return $vars;
}
add_filter( \'query_vars\', \'add_custom_query_vars\' );
或者另一种方法是:
function add_custom_query_vars( $vars ){
array_push($vars, "variable1", "variable2", "variable3");
return $vars;
}
add_filter( \'query_vars\', \'add_custom_query_vars\' );