問題描述
因此,顯示特定作者的帖子列表的默認網址如下所示:
http://domain.com/author/{username}
我想知道如何將該網址中的’author’ 更改為其他內容?
我正在一個特許學校的網站上工作,他們希望允許每位教師有一個”classroom” 的職位列表。所以想要的網址是
http://domain.com/classroom/{username}
最佳解決方案
你可能想嘗試.. http://wordpress.org/extend/plugins/custom-author-base/
希望有幫助..)
次佳解決方案
您可以將其添加到您的函數中,並將其從默認的”author” 重寫為”classroom”,
function new_author_base() {
global $wp_rewrite;
$author_slug = 'classroom';
$wp_rewrite->author_base = $author_slug;
}
add_action('init', 'new_author_base');
希望它能幫助你
參考文獻
注:本文內容整合自 Google/Baidu/Bing 輔助翻譯的英文資料結果。如果您對結果不滿意,可以加入我們改善翻譯效果:薇曉朵技術論壇。