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:
Go to your WordPress dashboard. Select Yoast SEO >> Search Appearance>> Taxonomies. Go to Category URLs and select 'Remove the categories prefix'. Save the changes.
How to delete categories. To delete an existing category, hover over it and click the Delete button. You can't delete the default Uncategorized category. If you delete a category with posts filed in it, they will be assigned to the Uncategorized category.
It's easy to do that. Simply open the functions. php file in your theme and add the following code at the end of the file: function prefix_category_title( $title ) { if ( is_category() ) { $title = single_cat_title( '', false ); } return $title; } add_filter( 'get_the_archive_title', 'prefix_category_title' );
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 use Yoast SEO
plugin just go to:
Search Appearance > Taxonomies > Category URLs.
And select remove
from Strip the category base (usually /category/) from the category URL
.
Regarding the tag removal I did not found any solution yet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With