There are upcoming maintenance events which may impact our services. Learn more

I am unable to submit a form on my WordPress site Print

  • 0

Problem Description

  • You have a WordPress website with a page caching plugin activated (like Super Cache or WP Rocket)
  • When submitting a form, like a contact form, nothing happens or an error about permissions is provided

Problem Resolution

Each form has a special security code that is printed on the page where your contact form resides using a hidden field (which is why you can't see it). This field, called a nonce, controls the validity of the form: restricting it to somewhere between 12 and 24 hours (WordPress defaults).

If your cached page isn't refreshed after 10 hours or so, then the nonce is invalidated and anyone submitting the form is going to get an error or simply not have their submission completed.

There are a few items to consider when fixing this:

Long Cache Lifetime: If your cache settings have a lifetime longer than 10 hours, then this is the reason for the nonce timeout. You will need to either reduce that value to 10 hours or less OR exclude your form pages from caching. Generally speaking setting the lifetime to 10 hours globally is better than no caching on pages with forms. Optimally all caching plugins would automatically detect forms on a page and reduce that page's specific cache lifetime, but this does not happen in practice (at least not with Super Cache nor WP Rocket)

WP-CRON: Even if your cache settings have a lifetime of 10 hours or less, in the event no dynamic activity occurs on your site after the 10 hours has expired, the cache file will not be replaced. To fix this, you will need to enable a real cron to trigger wp-cron.

By setting your cache lifetime to 10 hours or less and ensuring WP Cron runs frequently enough to refresh those cache files, you will ensure continuing functionality for the forms on your site.

 


Was this answer helpful?

← Back