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:-


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:-

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.