A WordPress Site Reports “This Request Is Not Valid Error” in Microsoft Word? Try This….

Recently I’ve been working on a site that required me to put the entire developmental site behind a maintenance mode site. Our maintenance mode plugin of choice is WP Maintenance Mode, as it allows me to control both the front end, styling it beautifully, whilst still continuing the development of the site.

However, when reporting on the development, we were hitting an issue with the site, in that links to the site were causing errors when being clicked on in Microsoft Word. This was the error we received:-

503-error

After investigation, the error is due to the Maintenance Mode plugin returning a “503: Service Unavailable” error. Whilst the site appears up to users, the header returns tell software that the site isn’t up, causing errors.

Thankfully, there’s an easy fix. Within your theme’s function file (or better yet in your own plugin), put in the following code:-

https://gist.github.com/rhyswynne/11139039

This returns a “200: OK” header, which means links can be clicked on in Word.

Hope that helps anybody! If you have any questions, or any way to improve the code, please let me know in the comments.

4 thoughts on “A WordPress Site Reports “This Request Is Not Valid Error” in Microsoft Word? Try This….”

  1. I’m a bit puzzled. Reminds me of clever SAP ABAP programmers catching “errors” by programming “IF returncode 0 returncode = 0”. Isn’t that a bit like that? Aren’t there circumstances where the error warning is warranted?

Leave a Reply

Your email address will not be published. Required fields are marked *