我无法重定向到插件页面..
我找不到页面..
add_action( 'init', 'myplugin_rewrite_internal' );
function myplugin_rewrite_internal() {
global $wp_rewrite;
add_rewrite_rule('oauth/facebook/$', plugins_url('/oauth/facebook/index.php'
,dirname(__FILE__)), 'top');
$wp_rewrite->flush_rules(true); // This should really be done in a plugin activation
}
我打电话的网址
www.example.com/oauth/facebook/index.php
我厌倦了 mod_rewite_url 仍然找不到页面
add_action('generate_rewrite_rules', array(&$this, 'generate_rewrite_rules'));
add_filter('mod_rewrite_rules', array(&$this, 'mod_rewrite_rules'));
function generate_rewrite_rules() {
global $wp_rewrite;
$non_wp_rules = array(
'oauth/facebook/?$plugin_name' => plugins_url('/oauth/facebook/index.php'
,dirname(__FILE__)),
);
$wp_rewrite->non_wp_rules = $non_wp_rules + $wp_rewrite->non_wp_rules;
}
function mod_rewrite_rules($rules) {
$rules = preg_replace('/^(RewriteRule ^.*+/?$)plugin_name (/)(.*) ([QSA,L])$/im', '1 3 [R=301,L]', $rules);
return $rules;
}
请纠正我..我已经尝试了很多次.. add_rewrite_url 仅适用于已注册的分类、标签、post_types 名称,如类别、自定义 post_type 如果我想重定向到未注册分类、标签、post_types 的页面怎么办?