WordPress自定义url 中的“author” 别名

默认WordPress 链接到文章“作者”的别名(slug name)是如 www.dreamfy.com/author/name 那样的,通过下面的代码,可以修改为www.dreamfy.com/profile/name 。这种情况适合开发非博客用途的站点,比如说商品展示网站等。

add_action('init', 'cng_author_base');
function cng_author_base() {
    global $wp_rewrite;
    $author_slug = 'profile'; // change slug name
    $wp_rewrite->author_base = $author_slug;
}
展开评论