Last night, I was trying to publish a post “Drop Multiple Tables with Common Prefix (SQL Server)“. I faced 403 Forbidden error, every time I pressed Publish button. I tried to publish blank post but failed. I tried to update old post but same error occurred.
I faced this error after updating WordPress to WordPress 4.8.2 . First thing came to my mind was, PHP version on my hosting could be the reason. I updated PHP version to PHP 7.1, but still failed to resolve the issue.
I google the issue and came across a statement which helped me to resolve the issue.
“It seems that WordPress has some parsing issue when post contains certain PHP commands. Apparently, modifying the mod_security rules in .htaccess helps to resolve this issue.”
Add the following code to .htaccess file in public_html folder (in some cases in /wp-admin folder) to resolve this issue.