• Resolved sgtscience

    (@sgtscience)


    Hi,

    I am trying to add a button like this:
    <button class=”btn-print” onclick=”window.print();return false;”>Print</button>
    to the confirmation of a gravity forms quiz so that people can print the responses and answers at the end. Whenever I try to save the confirmation wordfence blocks it with a screen saying “A potentially unsafe operation has been detected in your request to this site”. This happens even with the plugin disabled. How can I prevent this and add the print button?

    Steve

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sgtscience

    (@sgtscience)

    I was able to solve this issue.

    I was trying to add the button on a staging site using wp staging. Because the WAF was being controlled by the production site, I was not given the option to allow the blocked action. I disabled the WAF on the production site and was then able to save the confirmation with the button onclick.

    Thanks for reaching out.

    That solution would work but this would fix the problem.

    If you are using .user.ini (look in the root directory of your site for this), add the line below to the staging directory’s (this is the folder you want to turn the firewall off for) .user.ini file (or create a new .user.ini if it doesn’t exist). Add this code to it:

    auto_prepend_file = none

    If using .htaccess on PHP5:
    <IfModule mod_php5.c>
    php_value auto_prepend_file none
    </IfModule>

    If using .htaccess on PHP7:
    <IfModule mod_php7.c>
    php_value auto_prepend_file none
    </IfModule>

    This will solve the issue going forward. Alternatively you could optimize the firewall on the staging site which would create a .user.ini file for that folder.

    Tim

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wordfence blocking onclick=”window.print();return false;”’ is closed to new replies.