5

I have seen some other questions and answers on this but unable to resolve at the moment.

I have some categories setup as follows:

Blog

-- Sub Cat

The Permalinks are currently setup with custom type: /%category%/%postname%/ and the category base is set to .

At the moment

  • If I go to a post in a subcategory it works.
  • Accessing the parent blog category works.
  • Accessing the child category does not work

I have tried changing the permalinks to the following /%category%/%subcategory%/%postname%/.

This causes the following behaviour:

  • Main Blog category access works.

  • Sub Category access works.

  • Post within subcategory does not work.

Note: The link it tries to take me to is the following:

/blog/sub-cat-name/%subcategory%/long-post-name-or-something/

5 Answers 5

6

The cause of this issue for future reference was the '.' in the category base, which was added to resolve a previous issue. Removing this and using /category/postname (per question) works, so will look for an alternative resolution to the category base issue.

1

You can change your permalinks, adding some extension at the end:

/%category%/%postname%.html
0

Solution, Permalink > Common Settings > Custom Structure

Use this slug: /%category%/

Select only sub-category for the post. There is no need to select Parent Category for a post.

1
  • This does not work, the permalinks to the posts then lead to the sub category instead of the post.
    – StuartM
    Commented Nov 26, 2015 at 16:38
0

Solution using Yoast SEO plugin.

I had a similar problem which I solved by downloading and activating the Yoast SEO plugin, then on the main dashboard:

Yaost SEO > Settings > Categories and Tags > Categories > Additional settings.

disable "Show the categories prefix in the slug".

-1

Workaround

Settings > Permalinks > Common Settings

Custom Structure /%category%/%post_id%/%postname%/

Settings > Permalinks > Optional

Category base .

Tested with WordPress version 4.8

2
  • This solution does not work anymore. It breaks the blog.
    – Johansson
    Commented Jul 7, 2017 at 19:47
  • @JackJohansson I added which WordPress version to the answer, thanks for the suggestion. Commented Jul 8, 2017 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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