• Hi,

    I had several pages which had the same name as some of my categories.

    This meant that when I tried to load the page, the archive page was loaded instead. Perhaps this isn’t wanted by everyone, but I think pages should take precedence over categories.

    So I modified the plugin a bit, the function ‘no_category_base_rewrite_rules’ to be exact.

    $page = get_page_by_path($category_nicename);
    if(!$page){
    	$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]';
    }

    And I also added the action hook
    add_action(‘publish_page’,’no_category_base_refresh_rules’);

    http://wordpress.org/extend/plugins/wp-no-category-base/

Viewing 1 replies (of 1 total)
  • Thanks for this. For anybody else, replace lines 73-75 with his code. And add the action code at line 33.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP No Category Base] Suggestion – Don’t set re-write rules for categories with the same nam’ is closed to new replies.