Support » Plugin: Code Snippets » 404 Error after save

Viewing 15 replies - 1 through 15 (of 28 total)
  • Any answer here?

    Same problem, help please.

    Someone to provide an answer here please?

    Same problem: after update code disappeared, and it is not possible to enter and save it anymore, all we have is a 404 error page.

    Plugin Author Shea Bunge


    Hello everyone,

    Sorry to hear you are experiencing this problem.

    Can I ask which server and PHP version you are running on the sites that are experiencing this issue?

    @bungeshea, my PHP version is native 7.0.

    What do you mean by server? What information exactly do you need?

    I use PHP 7.3

    Sorry to pile on, but I’ve been getting a 403 error for weeks now when I save snippets on several but not all of my sites.

    Access to this resource on the server is denied!”

    I have to go directly into the mysql db and make the changes. Code snippets had been successfully running for a couple of years. I guess I kept thinking the problem would just go away…

    A did a test of 4 of my sites, two of which have the problem and two don’t. All have the same version of code snippets (2.13.3). All run on Linux.

    Site1 (PHP Version 7.0.33)
    Site2 (PHP Version 7.1.27)

    No problem
    Site3 (PHP Version 5.6.40)
    Site4 (PHP Version 7.0.33)

    You’ll notice that Site1 and Site4 have the same PHP version.

    Maybe there’s a Conflict with Theme or Plugin?

    @retunes – I deactivated ALL plugins except Code Snippets and switched my theme to Twenty Nineteen and the issue still happens (403) for me.

    @rolevine ah ok yes its very strange. On my local WordPress Installation Snippets works fine. But on Online Website it didnt work. But I tested it only on one Site because I didn’t need it on other sites.

    Guys and Dolls, I may have some answer
    Looks like the problem is not in the plugin but in the server. I realized this after trying another similar plugin and ending with the same issue, so I asked for support from my hosting provider – Greengeeks – that resolved it immediately.
    They have whitelisted mod_sec rule that caused this issue, and everything started working fine.
    Have a look into this, @bungeshea , sure you can solve this problem once and for all – Code Snippets is a fine plugin!

    @elenaocone thanks, will try later

    @elenaocone @retunes

    I edited my .htaccess file to include:

    <IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off

    and while the problem did indeed “go away”, this seems both dangerous and the “sledgehammer” approach to the problem. Of course, I have nearly zero expertise in server security, so my concern is based solely on the fact that I don’t like the idea of removing security and that my host says that they “strongly suggest” that I don’t leave those lines in my .htaccess file.

    Also, I looked at my sites that don’t have this problem and I don’t see the modsecurity rules touched in the htaccess files.

    Plugin Author Shea Bunge


    The reason why I was asking about which web servers this problem was occuring on is because it sounds similar to a previously reported problem.

    Essentially, what seems to be happening here is that the PHP code and the description HTML code is being submitted through a form, and before it can be processed by this plugin and saved to the database, mod_security is noticing that the request data contains PHP/HTML code and blocking it. This is more of a false-positive scenario, as the request data is intended to contain this code, but unfortunately I don’t know of a way I can bypass this in the plugin itself without potentially causing errors.

    A way to check if this really *is* mod_security causing this problem is to create and save an empty snippet, and see if that triggers the error. If not, it’s most likely working because you have not included any PHP or HTML tags in your snippet.

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘404 Error after save’ is closed to new replies.