Clash of the rewrites

Your best option is to register neighborhoods as a custom taxonomy and use that instead of categories. In your theme’s functions.php file, you just need to add:

function neighborhoods_init() {
    // create a new taxonomy
    register_taxonomy(
        'neighborhoods',
        'post',
        array(
            'label' => __( 'Neighborhoods' ),
            'hierarchical' => true
        )
    );
}
add_action( 'init', 'neighborhoods_init' );

Next, go into your permalinks settings page and click save to be sure they get refreshed. Now when you edit posts, you’ll have a new box in the sidebar for Neighborhoods. Your neighborhoods will now have links starting with /neighborhoods/! Of course, you’ll have to port over your categories (and you’ll probably want to remove the old categories to avoid confusion).

You have other options too when registering the taxonomy; see http://codex.wordpress.org/Function_Reference/register_taxonomy for all the details. For instance, you might consider adding 'rewrite' => array( 'slug' => 'neighborhood' ) to the array since each neighborhood will be singular, not plural, making the URLs e.g. /neighborhood/highland-park/ (hey, I’m nit-picky).

Note: be sure to remove RewriteRule ^neighborhoods/? pages/category/neighborhoods/ from your htaccess file, too.

Leave a Comment