0

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.