0

I have this issue I can't understand : recently (everything was working perfectly during years), some pages on my website are returning a 404 error while I can perfectly access to their content (even after removing any cache).

It's only "Third level" pages of a Custom Post Type : First level return 200 status code -- Second level page return 200 status code ----- Third level page return 404 error

Actually I only have this issue on a hierarchical Custom Post Type whose "CPT Base" I have removed.

When I go on the Dev Console from my Browser, I can see the 404 error even if the html with all the content is perfectly fine.

I try to reproduce the bug on a new install with the same plugins, content, and I have a 200 status code.

What am I missing ?

Here you have an example of these pages maybe it would be more clear : https://polesupnature.fr/btsa-gpn/programme/biologie-ecologie/

Here is the HTTP Header I get and the content is still returned perfectly… :

HTTP/2 404 
date: Wed, 16 Nov 2022 15:38:54 GMT
content-type: text/html; charset=UTF-8
server: Apache
x-powered-by: PHP/8.0
expires: Wed, 11 Jan 1984 05:00:00 GMT
cache-control: no-cache, must-revalidate, max-age=0
link: ; rel="https://api.w.org/"
link: ; rel="alternate"; type="application/
2
  • That page doesn't lead to a 404 when I load it. Did you get a chance to reset re-directs? Go to settings/permalinks, and then try loading the front again.
    – rudtek
    Commented Nov 15, 2022 at 3:35
  • I did it several times, but still, on the Chrome developper console, I still get a 404 error, and Google is removing my pages from its index…
    – PhpDoe
    Commented Nov 15, 2022 at 9:13

1 Answer 1

0

Actually, the issue came from the Remove CPT Base plugin. It is a solved problem now. The plugin author gave this explanation about what caused the 404 error :

I used pre_get_posts hook to convince WordPress that it should load specific content on specific URL, but 404 headers were already sent, so I had to use another hook that fires before sending headers – request hook.

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.