这可能会帮助您:
转到您的Settings => Permalinks => Cutom Structure
并粘贴此:
/category/%category%/article/%postname%/
还将此粘贴到
Category Base
字段:
category
这将适用于类别,但当您访问任何帖子时,都会受到欢迎
404 page not found
(这不是很好吗?)。
所以从这里偷东西answer
将此代码添加到主题函数中。php文件:
add_action( \'init\', \'wpa58471_category_base\' );
function wpa58471_category_base() {
// Remember to flush the rules once manually after you added this code!
add_rewrite_rule(
// The regex to match the incoming URL
\'category/([^/]+)/([^/]+)/([^/]+)(/[0-9]+)?/?$\',
// The resulting internal URL
\'index.php?category_name=$matches[1]/$matches[2]&name=$matches[3]&paged=$matches[4]\',
// Add the rule to the top of the rewrite list
\'top\' );
}
并切换回
Settings => Permalinks
然后单击保存更改。