0
我使用的是從我的插件的設置來產生重寫規則:爲什麼wordpress不能在我的插件中識別add_rewrite_rule?
$bioPage = $wpdb->get_var("SELECT settingValue FROM $table_name WHERE settingType='bioPage'");
$post = get_post($bioPage);
$slug = $post->post_name;
add_rewrite_tag('%player%','([^&]+)');
add_rewrite_rule('^'.$slug.'/([^/]*)$','/'.$slug.'/?player=$matches[1]','top');
我得到正確的蛞蝓。
我有一個網址,看起來像這樣:
mysite.com/info/?player=joe.smith.01
我希望它看起來像這樣:
mysiste.com/info/joe.smith.01
我使用的是add_rewrite_tag
所以WP將抓住該URL的變量。當我訪問一個結構像我試圖實現的頁面url時,我找不到一個頁面。
你修改htaccess文件?直接嘗試 –
我會,但我需要使用插件來改變重寫,因爲htaccess生活在主題文件之外。 – dcp3450