Viewing 3 replies - 1 through 3 (of 3 total)
  • WordPress category URLs, by default, have the keyword “category” hard-coded in them… unless you take special care to remove it (you didn’t mention this in your post).

    So even if you set the permalink to /blog/%category%/%postname%/, the URL for “fruits” (parent category) and “banana” (child category) will still be:

    example.com/blog/category/fruits/

    example.com/blog/category/fruits/banana/

    I don’t see the hard-coded “category” keyword in your category URL examples, unless you took additional steps to remove them (which, again, you didn’t mention in your post).

    Thread Starter zipitfast

    (@zipitfast)

    Hi @gappiah ,

    Sorry I must’ve forgottern but yes I did remove the “category” keyword via yoast.

    Moderator bcworkz

    (@bcworkz)

    With your URL scheme, WP has no way to distinguish between a category archive page request and a post request for a post called “page” in some category. It’s defaulting to the latter, hence nothing found. You could try adding a rewrite rule that explicitly matches “page” as a static string in a category archive request, but if the existing post rewrite rule still matches before your added rule is reached, it will not help any.
    https://developer.ww.wp.xz.cn/reference/functions/add_rewrite_rule/

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom blog posts and category permalink structure’ is closed to new replies.