我正在尝试为d3可视化制定一个重写规则,该规则将保留在主题文件夹中。最终我想要
d3/[some-year]/[some-string]
重定向到
wp-content/themes/my-theme/d3-library/[some-year]/[some-string]/index.html
但是,我无法使捕获规则起作用。这是我到目前为止的内容:
function d3_rewrite() {
add_rewrite_rule(
'wp-content/themes/d3/(20[0-9][0-9]/.*)',
'wp-content/themes/my-theme/assets/d3-library/$match[1]/index.html',
'top'
);
}
add_action('init', 'd3_rewrite');
有谁知道为什么这不起作用?
使用wp-content/themes/my-theme/assets/d3-library/$1/index.html
。问题出在替换后向引用中。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句