Permalinks incorrectly inserting multiple categories

So, I've recently updated my site and theme to wp 4.5.3 (en-GB)and ported across the content from the old site/theme (it was pretty out of date).

The site has 4000'ish posts, with custom post types and taxonomies.

Most content is held in the default post type, with the taxonomy 'category' which are set up hierarchically.

Typically, URLs get generated as http://example.com/food/postname where food is the top-level tag, and the post may have several sub-tags (fruits, fried, etc).

Since updating, however, Wordpress is generating invalid URLs, for example http://example.com/food/fruits/postname based on the example above, which is not found.

It doesn't do it in a vanilla Wordpress install, but I could do with knowing where in my theme or plugins to start looking.

Taxonomies are defined with (where POSTTYPE_PLACES etc are the names associated with post types in my Wordpress theme)...

<?php
register_taxonomy(    
    'category',
    array(
        POSTTYPE_PLACES,
        POSTTYPE_EDITORIAL, 
        POSTTYPE_CUSTOMSECTIONS,
        POSTTYPE_PAGE ),
    array(
        'label' => __('Category'),
        'labels' => $labels,
        'hierarchical' => true,
        'show_ui' => true,
        'show_admin_column' => true,
        'query_var' => true,
        'rewrite' => array( 
            'slug' => '',
            'hierarchical' => false,
            'with_front' => false
        )
    )
);

I have a custom permalink structure of /%category%/%postname%/ in Settings -> Permalinks. I've refreshed the permalink rules which hasn't helped one bit.

Solutions

Looks like it was trying to create a taxonomy called category which was causing odd behaviour, ripping this code out did the trick, though some rewrite rules were necessary to make paginated archive pages work.

Similar questions

Code Formatted with SyntaxHighlighter Evolved Appearing Incorrectly on iPad/iPhone
I have just started a programming blog and I am using the SyntaxHightlighter Evolved plugin to format my code. On most browsers this is working just fine. However if I attempt to view the site from either an iPhone or iPad the line numbers and code are no longer aligned. Basically the problem seems to be that the line numbers and code fonts are siz...
Query Posts Incorrectly Displaying Tags Archives
When I go to a tag archive ( http://themeforward.com/demo2/tag/n/ for example) ALL the posts on my blog are being displayed, not just the posts with that tag - and I'd like to fix this. Here's my tag map, click any tag and ALL posts are being pulled http://themeforward.com/demo2/templates/547-2/ Here is how I am querying posts (there is custom code...
plugins_url() incorrectly returns a url with www subdomain
I'm working on a plugin which we'll call "my-plugin" for the purposes of this question. The my-plugin directory looks like this: In script.php I have a section of code that specifies some JS. In it, I need a URL for ajax.php. e.g.: My wordpress domain is configured with a subdomain-less base url e.g.: http://example.com/ however the URL returned fr...
Wordpress featured image url rendering incorrectly when page is loaded causing image to break
I migrated a site from my testing server to the live server. Everything transferred normally only the featured images are broken and not displaying. The URL's are being rendered incorrectly even if i re-upload the image. the testing server is dave-conner.com the live server is qmpdirect.com the page where the issue is happening on is http://qmpdire...
wp_insert_post incorrectly escapes HTML comments when they include tags
I'm working on writing a script to import data from a custom CMS into Wordpress. As part of this, I need to import the post content exactly, without modifying anything. However, some of the posts contain HTML comments which contain tags, and this seems to be confusing Wordpress. I've distilled my script down into a small representative example: Thi...
Post incorrectly displaying as page
I have a small WordPress install that I'm setting up, and have run into an issue that I've encountered before, but do not understand the cause. Issue: With permalinks set to /%postname%/, on a site with the following: Most everything works as expected, however there is one post with a slug of "swampism" which displays (incorrectly) in the page.php ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.