admin管理员组文章数量:1130349
I have added to my child theme functions.php:
function mychildtheme_register_query_vars( $vars ) {
$vars[] = 'papers';
return $vars;
}
add_filter( 'query_vars', 'mychildtheme_register_query_vars' );
When I try to query the var in another page
echo (get_query_var( $papers, $default='test' ));
the result is an empty string ('test' gets echoed), even if:
global $wp_query;
var_dump($wp_query->query_vars);
shows the vars and their values.
Any hints ? thanks
I have added to my child theme functions.php:
function mychildtheme_register_query_vars( $vars ) {
$vars[] = 'papers';
return $vars;
}
add_filter( 'query_vars', 'mychildtheme_register_query_vars' );
When I try to query the var in another page
echo (get_query_var( $papers, $default='test' ));
the result is an empty string ('test' gets echoed), even if:
global $wp_query;
var_dump($wp_query->query_vars);
shows the vars and their values.
Any hints ? thanks
本文标签: Custom query vars empty
版权声明:本文标题:Custom query vars empty 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749123703a2319425.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论