这是我的代码:(使用默认的wp主题:twenty1414)
function my_rewrite_rules( $wp_rewrite ) {
$non_wp_rules = array(
'assets/(.*)' => 'wp-content/themes/twentyfourteen/assets/$1',
);
$wp_rewrite->non_wp_rules = $non_wp_rules + $wp_rewrite->non_wp_rules;
}
function my_flush_rewrite_rules() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
add_action( 'init', 'my_flush_rewrite_rules');
add_action('generate_rewrite_rules', 'my_rewrite_rules');现在,我访问link:
mysite.domain/wp-content/themes/twentyfourteen/assets/css/global.css => //yes, base css file
mysite.domain/assets/css/global.css => //not working有人能帮帮我吗?
发布于 2014-11-25 23:11:13
您需要稍微调整一下重写规则
$non_wp_rules = array(
'css/(.*)' => 'wp-content/themes/twentyfourteen/assets/css/$1',
'js/(.*)' => 'wp-content/themes/twentyfourteen/assets/js/$1',
);https://stackoverflow.com/questions/27128631
复制相似问题