As more sites move to advanced caching solutions, it’s getting more difficult to have dynamic content coming in through plugins and similar solutions. Recently I was experimenting with WP-Polls, a popular (free) WordPress polling plugin alongside CloudFlare (Automatic Platform Optimization).
After installing the WP-Polls plugin on a WordPress site, I went ahead and put it on my custom post type, styled it, made it responsive, and built about 20 test polls. After some cross-device testing I was thinking this seemed like a great proof-of-concept. I reset the poll count and sat back for a few days to see how many votes came in.
After 24 hours the number was nearly zero, so I knew something was wrong. I hopped on the site, cast a test vote concerning a kangol vs. coyote, and got the error response: “Failed To Verify Referrer” which hadn’t come up in earlier testing. Odd…
After some research I discovered this was due to caching, most likely the site’s use of CloudFlare APO. It turns out that this has been a problem with the WP-Polls plugin since at least 2017… and it’s also a problem with a number of other plugins that handle polls, voting, surveys, and similar functions.
Because the plugins make use of AJAX elements for the voting mechanism and I didn’t see any problems when testing, I had thought caching wouldn’t be a problem, but I was clearly wrong.
While a few clever fixes exist, such as creating a webhook that purges the cache after each vote (obviously this won’t be practical on a site with a meaningful amount of traffic), it seems like the only real option was to find a new plugin.
I ditched WP-Polls and my custom CSS for it, and did a hunt for a similarly strong, hopefully free, plugin. Ultimately I ended up with Democracy Poll, which actually works great. It has a solid feature set, all the UX options I was searching for, good styling capability out of the box with little custom CSS required and, best of all, it works with my cache setup.
I will note that even Democracy Poll doesn’t work with heavy caching out of the box! You have to go into settings and enable a feature to get it to work properly. You have to tick the box next to, “Force enable gear to working with cache plugins.” If the condition is “ON” you’re all set. The wording is a bit odd and the plugin has some spelling errors scattered throughout, but it actually works quite well.
As you can see, this is fixed and working now. Even with a number of CloudFlare’s speed enhancements running, most particularly APO and Mirage, the poll plugin still works as planned. I will note that I’ve yet to turn on Rocket Loader as that’s taking the risk factor up a notch, but I’ll be testing it out in the coming weeks.
Sal October 20th, 2022
Posted In: Wordpress