Change category name without 404 errors

Today I try to change category name from anti-virus to virus but using old permalink /%category%/%postname%.html and i found later that there have 404 errors. I try to looking around on search engine but could not find any mod_rewrite to fix this problem. Finally I look into source code of WordPress 2.1 and change the code below:-

/wp-includes/category.php

Search for line 168

function get_category_by_path($category_path, $full_match = true, $output = OBJECT) {

Add this code after global $wpdb;

$category_path = str_replace('old-category', 'new-category', $category_path);

For above I changed my /wp-includes/category.php to

......
function get_category_by_path($category_path, $full_match = true, $output = OBJECT) {
	global $wpdb;
	$category_path = str_replace('anti-virus', 'virus', $category_path);
......

Leave a Reply

You must be logged in to post a comment.