我有网址http://domain.com/real-estate-news/phuket-luxury-property-in-high-demand-ms 其中“real-estate-news”是类别,“phuket-luxury-property-in- high-demand-ms”是帖子名称。当我打印 $wp_query->query_vars['name']; 它给出了 post slug 并且 $wp_query->query_vars['category_name'] 给出了类别 slug。
我想生成一个新的网址,例如http://domain.com/real-estate-news/phuket-luxury-property-in-high-demand-ms/xyz
并想在查询变量中获取 xyz
echo $wp_query->query_vars['name']; // print "phuket-luxury-property-in-high-demand-ms"
echo $wp_query->query_vars['category_name']; // print "real-estate-news"
echo $wp_query->query_vars['section']; //print "xyz"
如何在wordpress中添加部分查询变量请帮助我