Hello Everyone,
If you are trying to remove "category" base from url without any plugin then use my this code
URL Before Add this code like https://www.wp-experts.in/blog/category/wordpress/ URL After Add this code in your theme function like this https://www.wp-experts.in/blog/wordpress/ ------------------------------------------------------------------------------------------------------------/* Remove category base usign hooks */ register_activation_hook(__FILE__, 'raghunath_category_base_refresh_rules'); register_deactivation_hook(__FILE__, 'raghunath_category_base_deactivate'); /* actions */ add_action('created_category', 'raghunath_category_base_refresh_rules'); add_action('delete_category', 'raghunath_category_base_refresh_rules'); add_action('edited_category', 'raghunath_category_base_refresh_rules'); add_action('init', 'raghunath_category_base_permastruct'); /* filters */ add_filter('category_rewrite_rules', 'raghunath_category_base_rewrite_rules'); add_filter('query_vars', 'raghunath_category_base_query_vars'); // Adds 'category_redirect' query variable add_filter('request', 'raghunath_category_base_request'); // Redirects if 'category_redirect' is set function raghunath_category_base_refresh_rules() { global $wp_rewrite; $wp_rewrite->flush_rules(); } function raghunath_category_base_deactivate() { remove_filter('category_rewrite_rules', 'raghunath_category_base_rewrite_rules'); // We don't want to insert our custom rules again raghunath_category_base_refresh_rules(); } /** * Removes category base. * * @return void */ function raghunath_category_base_permastruct() { global $wp_rewrite; global $wp_version; if ($wp_version >= 3.4) { $wp_rewrite->extra_permastructs['category']['struct'] = '%category%'; } else { $wp_rewrite->extra_permastructs['category'][0] = '%category%'; } } function raghunath_category_base_rewrite_rules($category_rewrite) { $category_rewrite=array(); /* WPML is present: temporary disable terms_clauses filter to get all categories for rewrite */ if (class_exists('Sitepress')) { global $sitepress; remove_filter('terms_clauses', array($sitepress, 'terms_clauses')); $categories = get_categories(array('hide_empty' => false)); add_filter('terms_clauses', array($sitepress, 'terms_clauses')); } else { $categories = get_categories(array('hide_empty' => false)); } foreach($categories as $category) { $category_nicename = $category->slug; if ( $category->parent == $category->cat_ID ) { $category->parent = 0; } elseif ($category->parent != 0 ) { $category_nicename = get_category_parents( $category->parent, false, '/', true ) . $category_nicename; } $category_rewrite['('.$category_nicename.')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?category_name=$matches[1]&feed=$matches[2]'; $category_rewrite['('.$category_nicename.')/page/?([0-9]{1,})/?$'] = 'index.php?category_name=$matches[1]&paged=$matches[2]'; $category_rewrite['('.$category_nicename.')/?$'] = 'index.php?category_name=$matches[1]'; } // Redirect support from Old Category Base global $wp_rewrite; $old_category_base = get_option('category_base') ? get_option('category_base') : 'category'; $old_category_base = trim($old_category_base, '/'); $category_rewrite[$old_category_base.'/(.*)$'] = 'index.php?category_redirect=$matches[1]'; return $category_rewrite; } function raghunath_category_base_query_vars($public_query_vars) { $public_query_vars[] = 'category_redirect'; return $public_query_vars; } function raghunath_category_base_request($query_vars) { if(isset($query_vars['category_redirect'])) { $catlink = trailingslashit(get_option( 'home' )) . user_trailingslashit( $query_vars['category_redirect'], 'category' ); status_header(301); header("Location: $catlink"); exit(); } return $query_vars; }---------------------------------------- Enjoy Code!
Wow! In the end I got a webpage from where I can really obtain valuable information regarding my study
and knowledge.
Your Most Welcome!
Greetings, I believe your web site might be having browser compatibility issues.
Whenever I take a look at your website in Safari, it
looks fine but when opening in IE, it’s got some overlapping issues. I simply wanted to give you a quick heads up! Aside from that, great website!
Your Most Welcome:), and thanks for suggest about browser compatibility issues
Hello, I check your blogs daily. Your story-telling style is awesome, keep doing what you’re doing!
Your Most Welcome:)
Appreciating the time and energy you put into your blog and in depth information you offer.
It’s good to come across a blog every once in a while that isn’t the
same out of date rehashed information. Fantastic read!
I’ve bookmarked your site and I’m including your
RSS feeds to my Google account.
Hey! I’m at work browsing your blog from my new iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Keep up the excellent work!
Your Most Welocme!
I am here sharing my knowledge for every one on free of cost.
Raghunath
Believe in Better
Good day I am so delighted I found your webpage,
I really found you by accident, while I was browsing on Askjeeve for something else, Anyways I am here now and would just like to say thanks a
lot for a incredible post and a all round exciting blog (I also
love the theme/design), I don’t have time to go through it all at the moment but I have saved it and also included your RSS feeds, so when I have time I will be back to read much more, Please do keep up the fantastic work.
Your most welcome!
http://www.wp-experts.in/blog/about/
Howdy! I understand this is kind oof off-topic but I had to ask.
Does building a well-established blog like yours take a large amount of work?
I’m brand new to blogging however I do write in my diary everyday.
I’d liuke to start a blog so I can share my personal experience and views online.
Pleaqse let me know iif you have any ideas or tips for new aspiring bloggers.
Thankyou!
Wow! Thank you! I constantly needed to write on my website something like that. Can I take a fragment of your post to my blog?
This is really interesting, You are a very skilled blogger.
I have joined your rss feed and look forward to seeking more of your fantastic post.
Also, I have shared your web site in my social networks!
Howdy! Would you mind if I share your blog with my twitter group?
There’s a lot of folks that I think would really enjoy your content.
Please let me know. Many thanks
Hello There. I discovered your blog the use of msn. That is a really neatly written article.
I will make sure to bookmark it and return to learn more of your
helpful info. Thank you for the post. I will certainly
return.