I would like to remove the category & tag base from wordpress URL. I have come across other posts and solutions which used plugins. I would like to stay away from plugins and have a solution from within functions.php. This would prevent any future plugin updates or wordpress default files from being changed.
Any help would be appreciated. Thanks!
I have tried these solutions so far:
- This Htaccess solution did not work: http://mikepayne.co/2011/remove-category-base-from-url/
- These methods also failed: http://www.askapache.com/wordpress/remove-category-wordpress-urls.html
instead put this in your functions.php works fine, no redirect problems.
The non-category plugin did not work for me.
For Multisite WordPress the following works:
\
;/%category%/%postname%/
. This will display your url aswww.domainname.com/categoryname/postname
;yourdoamainname/blog/
. Ignore it. If you save now the work you did in step 4 will be overwritten. This step of opening permalink page but not saving in needed to update the database.https://wordpress.org/plugins/remove-category-url/ Use this plugin it does the job perfectly of hiding the category-base It does not require any setting just install and activate.
Select Custom Structure in permalinks and add /%category%/%postname%/ after your domain. Adding "/" to the category base doesn't work, you have to add a period/dot. I wrote a tutorial for this here: remove category from URL tutorial
I liked this solution:
If you want to remove
/category/
from the url, follow these two steps:/%category%/%postname%/
.
Save it and you’ll see your URL changed to this format: http:/yourblog.com/quotes/
(Source: http://premium.wpmudev.org/blog/daily-tip-quick-trick-to-remove-category-from-wordpress-url/)
If you're still searching for the combination (tags, categories and pages on the url-base), you can do it like I did.
.
) for the category- and tag-base (https://premium.wpmudev.org/blog/removing-category-base-urls-wordpress/)Tested using Wordpress 3.9.1
If you have pages, categories or tags having the same name, the system will take: