I am having a very annoying issue where certain posts redirect to 404 page when trying to save or publish a post. It only happens to a few posts and did not happen prior to the last few WP updates. I tried disabling all plugins and using different themes with no change. I also tried creating a new post on a different WordPress installation again with no change.

In one post I narrowed it down to one line that if taken out solves the issue, though there is no such line in another post that gives 404 error:


or even:


But this causes no issues:


I realise this is a PHP global variable but I don't see why it should cause an issue in a post body as WP should not be interpreting it as code. The PHP variable is part of the code I am displaying within pre tags. Another post that now redirects to 404 page saved just fine when it was first written and so did the post with the GET variable. This means something must have changed in WP.

Can anyone explain why this is happening? It seems like a bug to me.

  • Post your code please. It is impossible to tell what your are doing. – s_ha_dum Jul 26 '15 at 14:26
  • Like I said it's not the code it's that the post redirects to 404 page when the line above is present anywhere in the post body. It is not supposed to be interpreted as code but rather as text. – DominicM Jul 26 '15 at 14:44
  • 1
    And it will be interpreted as text because WordPress doesn't process PHP in the post body... unless you or a plugin or a theme is messing with the system. I don't know which but I am 99% sure it isn't Core. Have you disabled your plugins and switched to a bundled theme like Twenty Fifteen? – s_ha_dum Jul 26 '15 at 14:49
  • I just tried with another WP install with same results. All plugins were disabled. Theme was TwentyThirteen and I also tried TwentyTwelve. I created new post with only '$_GET["ip"];' in the body and tried saving it as a draft. Still 404. Anything else I can try? – DominicM Jul 26 '15 at 15:19
  • I tried the exact same thing with current WP 4.2.3, it does get weirdly - although it is correct, because it is consider as text - "corrected" like this »$_GET[„IP“]« though, but I cannot confirm it creating a 404 error. – Nicolai Jul 26 '15 at 16:30

Your Answer

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

Browse other questions tagged or ask your own question.