如何在WordPress中更改作者URL子弹和基准

Do you want to change the author url slug and base in WordPress?

您是否要在WordPress中更改作者的网址链接和基础?

WordPress comes with built-in support for SEO friendly URL structure, also known as pretty permalinks. This feature allows you to choose URLs for your posts, pages, and categories by editing their slugs.

WordPress内置了对SEO友好URL结构 (也称为漂亮的永久链接)的支持。 通过此功能,您可以通过编辑帖子,页面和类别的条目来选择它们的URL。

This feature also creates pretty links for author pages. However, there is no option for you to customize the author URL.

此功能还为作者页面创建漂亮的链接。 但是,您无法自定义作者URL。

In this article, we will show you how to easily change the author URL slug and base in WordPress.

在本文中,我们将向您展示如何轻松地更改WordPress中的作者URL代码和基础。

如何在WordPress中更改作者URL子弹和基准

什么是URL Slug和URL Base? (What is a URL Slug and URL Base?)

In WordPress terminology, a slug is a title of a publicly viewable page in WordPress formatted to be used in URLs.

WordPress术语来说 ,“ slug”是WordPress中可公开浏览的页面的标题,其格式设置为可在URL中使用。

It looks like this:

看起来像这样:

https://example.com/author/syed-balkhi/

https://example.com/author/syed-balkhi/

In the example above, syed-balkhi is the slug and author is the base.

在上面的示例中, syed-balkhisyed-balkhiauthor是基础。

While users can change the slug and base for posts, pages, categories, and tags, its not possible to change the author URL in WordPress.

尽管用户可以更改帖子,页面, 类别和标签的标记和基础,但无法在WordPress中更改作者URL。

If you wanted to use ‘contributor’ instead of ‘author’ or if you wanted to change the author slug altogether, then you’re in the right place.

如果您想使用“贡献者”而不是“作者”,或者您想要完全更改作者,那么您来对地方了。

Let’s see how you can easily change author URL slug and base in WordPress.

让我们看看如何轻松地更改WordPress中的作者URL代码和基础。

更改WordPress中的作者子弹 (Changing The Author Slug in WordPress)

First thing you need to do is install and activate the Edit Author Slug plugin. For more details, see our step by step guide on how to install a WordPress plugin.

您需要做的第一件事是安装并**Edit Author Slug插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, this plugin will add a group of options to each user profile page.

**后,此插件将向每个用户个人资料页面添加一组选项。

If you want to edit the slug of a user on your site, then you need to go to Users » All Users page. Next, click on the ‘Edit’ link below a username.

如果要编辑站点上用户的信息,则需要转到“ 用户”»“所有用户”页面。 接下来,点击用户名下方的“编辑”链接。

如何在WordPress中更改作者URL子弹和基准

This will take you to the Edit User screen. Simply scroll down to ‘Edit Author Slug’ section, and you will see a number of choices that you can use as author slug. You can even enter a custom slug.

这将带您进入“编辑用户”屏幕。 只需向下滚动到“编辑作者子弹”部分,您将看到许多可用作作者子弹的选择。 您甚至可以输入自定义子弹。

如何在WordPress中更改作者URL子弹和基准

Once you have made the changes, click on the ‘Update User’ button and preview your site.

进行更改后,单击“更新用户”按钮并预览您的站点。

Now when you click on the author name in a post to view the author page, you will see that it is using the author slug you choose for them.

现在,当您单击帖子中的作者姓名以查看作者页面时,您将看到它正在使用为他们选择的作者信息。

改变作者基础 (Changing Author Base)

If you’re building a site where you want to change the author base from /author/ to something else, then you can do that as well with this plugin.

如果您要在一个站点上将作者库从/ author /更改为其他内容,则也可以使用此插件来完成。

Simply head over to the Settings » Edit Author Slug page. Here you will see an option to change the author base and even choose different author base for users with different user roles.

只需转到设置»编辑作者子弹页面。 在这里,您将看到一个选项,用于更改作者基础,甚至为具有不同用户角色的用户选择不同的作者基础。

如何在WordPress中更改作者URL子弹和基准

Once you are finished, click on the save changes button to store your settings. You can now preview your site and click on the author link to see the changes in action.

完成后,单击保存更改按钮以存储您的设置。 现在,您可以预览您的站点并单击作者链接以查看实际的更改。

设置用于SEO的重定向 (Setting up Redirects for SEO Purposes)

Changing author slugs and base on an established website can have negative SEO ramifications especially if your author archives are indexed.

更改作者信息和在已建立的网站上进行搜索可能会对SEO产生负面影响,尤其是在对您的作者档案进行了索引的情况下。

People coming to author pages from search engines will see a 404 error message. To avoid this, you need to set up redirects from old URLs to new author slug and base.

人们从搜索引擎进入作者页面将看到404错误消息。 为避免这种情况,您需要设置从旧URL到新作者和基础的重定向。

First, you need to install and activate the Redirection plugin.

首先,您需要安装并**重定向插件。

Upon activation, head over to Tools » Redirection page. You’ll be greeted by the plugin’s set up wizard. You can follow the on-screen instructions to continue set up or click on the ‘Manual Install’ link to skip it.

**后,转到工具»重定向页面。 插件的设置向导会打招呼。 您可以按照屏幕上的说明继续设置,也可以单击“手动安装”链接以跳过设置。

如何在WordPress中更改作者URL子弹和基准

Next, you will reach the Redirection page. From here, scroll down to the ‘Add new redirect’ section. You need to add the old author page URL as the source and the new author URL page as the target.

接下来,您将进入“重定向”页面。 从此处向下滚动到“添加新重定向”部分。 您需要添加旧的作者页面URL作为源,并添加新的作者URL页面作为目标。

如何在WordPress中更改作者URL子弹和基准

Click on the ‘Add redirect’ button to save your changes.

点击“添加重定向”按钮以保存您的更改。

The plugin will now automatically redirect visitors coming to the old author page to the new URL.

现在,该插件将自动将访问旧作者页面的访问者重定向到新URL。

Now if you have also changed the author base, then you will need to dynamically detect those URLs and redirect them.

现在,如果您还更改了作者基础,那么您将需要动态检测这些URL并重定向它们。

Let’s suppose you changed the author URL base to ‘contributor’. This is how you will set up the redirect.

假设您将作者URL库更改为“贡献者”。 这是设置重定向的方式。

如何在WordPress中更改作者URL子弹和基准

Source: https://example.com/author/(.*)$ Target: https://example.com/contributor/$1

来源:https://example.com/author/(.*)$目标:https://example.com/contributor/$1

If you selected the author URL base to be created using the user role, then you will need to do this for every user role, except when the user role itself is ‘author’.

如果选择要使用用户角色创建的作者URL库,则将需要对每个用户角色执行此操作,除非用户角色本身是“作者”。

To learn more about redirects, see our guide on how to set up redirects in WordPress.

要了解有关重定向的更多信息,请参阅有关如何在WordPress中设置重定向的指南。

We hope this article helped you change author slug and base in WordPress. You may also want to see our list of most wanted WordPress tips, tricks, and hacks.

我们希望本文能帮助您更改WordPress的作者信息和基础。 您可能还想查看我们最想要的WordPress技巧,窍门和hack列表

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress****。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/plugins/how-to-change-author-url-slug-and-base-in-wordpress/