Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove category in WordPress url

Tags:

php

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?

like image 833
aletede91 Avatar asked Mar 17 '26 05:03

aletede91


1 Answers

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

like image 156
Marcin Czyz Avatar answered Mar 19 '26 19:03

Marcin Czyz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!