Many times we need to remove the category or blog slug from wordpress URL. We can very easily remove the blog word from wordpress blog URL. In this tutorial, We are going to show remove blog word from wordpress permalink url. this is useful when you upgraded your wordpress multisite installation.
remove blog word from wordpress permalink url
I personally used wordpress mu for long time. When wordpress 3.0 launched with multisite functionality we started using wordpress 3.0. Removing blog and category slug is very important for many clients.
I am assuming you are using wordpress 3.0 multisite installation. If that is so then you need to do following action.
First login to wordpress admin and go to Super Admin > Sites > Edit
and Scroll down to “Permalink Structure” and remove the “/blog” part. That should work.
Image is shown as like.
than update the option and your issue will be solved. If you are still facing issue then you need to use following code in your functions.php file. Following code is useful for those who updated wordpress mu from wordpress 3.0, other wise they can use above action.
add_filter("pre_update_option_category_base","remove_blog_slug"); add_filter("pre_update_option_tag_base","remove_blog_slug"); add_filter("pre_update_option_permalink_structure","remove_blog_slug"); /* just check if the current structure begins with /blog/ remove that and return the stripped structure */ function remove_blog_slug($tag_cat_permalink){ if(!preg_match("/^\/blog\//",$tag_cat_permalink)) return $tag_cat_permalink; $new_permalink=preg_replace ("/^\/blog\//","/",$tag_cat_permalink ); return $new_permalink; }
If you want advanced permalinks then I can suggest following wordpress plugin for changing the permalink
Advanced Permalinks
advanced permalink options that allow you to:
- Have multiple permalink structures. Permalinks can be assigned to posts or ranges of posts
- 301 redirect old permalink structures (many structures are allowed)
- Category-specific permalinks. Posts in certain categories can be assigned a permalink structure
- No need to have a base to the category permalink!
- Change author permalinks
- Enable periods in permalinks – perfect for migrating old websites
If you need more information or help then you can contact me through contact form.
This didnt work for me, I know get 404 errors for all posts.
I followed your instructions carefully. Can you help please?
You just need to visit the permalink page after using my step.
it’s working now, not sure what was wrong.
Thanks
Thank you for help 🙂
Cool.Thank you.
You’ve really helped me unnrastedd the issues. Thanks.
I have tried everything. Still can’t get this to work. I think the next thing will be forcing wordpress to use Subdomains
Can you tell me your issue with more details or you can send me email.
Thanks!! Problem solved!
“Super Admin > Sites > Edit” did not work.
But your php snippet did it.
Thank you, Purab!
I spent several hours trying to remove the blog slug and nothing worked. I found your beautiful code and it works like a charm. You are a star!