404 template part not loading when custom permalink structure is set

I’ve set a custom permalink structure to have /blog/ included in the permalinks for posts. This is the custom permalink declaration in the WordPress settings page: /blog/%postname%/

The issue I’m facing is that the 404 page template is not loading if the custom permalink structure is active. Everything works fine if using the /%postname%/ permalink structure or not using permalinks at all.

Any thoughts?
Thanks,
Marto

Have you tested with another theme to find out if Sage is the culprit or not?

Regardless, I suggest you install Debug Bar – WordPress plugin | WordPress.org or something similar that lets you see the request and which rewrite rule is being matched by your URL. That should help you tracking down any underlying issue.

Possibly also add https://wordpress.org/plugins/debug-bar-rewrite-rules/ to further ease debugging rewrite rules if needed.

1 Like

Hello folbert,
I have tested with twentytwenty theme and in that case it works.

Any idea here? this is actually happening on any Sage9 theme that I’ve tried when I try to use a custom permalink structure for posts.

Here’s the debug info from the Debug Bar.


Sorry, I misread your first post and thought you got 404 on a valid blog-url. The plugins I suggested ant that you screenshotted probably doesnt help at all.

FWIW, I have Sage9-sites with custom permalink structure, including ”blog” where the 404-template loads without any issues.

I dont have any other suggestion than to do some code diving to, for example, see if WP is loading another template or maybe change the content of your 404-tpl to just a harcoded text to make sure it is not loaded.