duanpei8518
2017-03-02 15:49 阅读 10
已采纳

删除WordPress网址中的类别

I have a WordPress blog with posts that has categories, this could be an example of my url:

www.example.it

The url for my post is now:

www.example.it/sample-post

The url for my category list of posts is now:

www.example.it/category/my-category

I would like my urls like this:

wwww.example.it/sample-post (for posts)

www.example.it/my-category (for categories)

After googled I founded this solution that I tried:

Go to Setting > Permalinks
Select Custom Structure
Add /%category%/%postname%/ after your domain
Change Category Base to period/dot.

In this way the category url is correct:

www.example.it/my-category

but post url is not:

www.example/my-category/sample-post

What could I change for get the url like I want?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • 已采纳
    douxiangshi6568 douxiangshi6568 2017-03-02 17:00

    Restore the permalink selecting "Post name" and then install this plugin. No configuration needed, it replaces the word "category" in the url of category template.

    https://wordpress.org/plugins/no-category-parents/

    点赞 评论 复制链接分享
  • dsl36367 dsl36367 2017-03-02 16:31

    You don't need PHP to do this, just go to Settings->Permalinks and select "Post name".

    If you want to make some custom link structure, please take a look at Wordpress Codex

    点赞 评论 复制链接分享
  • duan47676379 duan47676379 2017-03-02 16:40

    Remove %category% from your permalink structure and install Remove Category URL plugin.

    点赞 评论 复制链接分享

相关推荐