AFI AFI

WP-Polls

Estimated reading: 3 minutes Updated August 1, 2026

WP-Polls is a long-standing WordPress polling plugin with AJAX voting, multiple-answer support, and template customisation. Advanced Form Integration captures poll votes and routes the data to any of 200+ destinations.

What you’ll need

  • The WP-Polls plugin installed and activated.
  • At least one poll created under Polls → Add Poll.
  • The Advanced Form Integration plugin installed and activated.

When the trigger fires

AFI registers a single Poll Voted trigger for WP-Polls. It fires when a vote is recorded and the poll counters have been updated in the database.

Data captured

Field Field key Format
Poll ID poll_id Numeric ID
Poll Question question Text, the poll question
Selected Answer selected_answers Text, comma separated when the poll allows more than one answer
Visitor IP user_ip IP address

Create the integration

  1. Go to WP Admin → AFI → Add New.
  2. Enter an Integration Title, e.g. WP-Polls: Poll Voted → Google Sheets.
  3. In Trigger → Form/Data Provider, select WP-Polls.
  4. In Form/Task Name, choose Poll Voted.
  5. In Action → Platform, pick the destination and complete the field mapping.
  6. Optional: configure Conditional Logic so only matching events are sent.
  7. Click Save Integration.

Screenshot: AFI Add New screen with WP-Polls selected as the Form/Data Provider

How AFI listens for votes

AFI hooks wp_polls_vote_poll_success, fired from ajax_vote_poll() in wp-polls.php only after both counter updates have succeeded; a failed query throws before that point is reached. The hook itself takes no arguments, so AFI reads the poll ID and the selected answers from $_POST exactly as the plugin’s own vote handler does, which is safe because the hook runs synchronously inside the same request. Question and answer text are resolved through $wpdb->pollsq and $wpdb->pollsa, real $wpdb properties the plugin registers at load time rather than guessed table names. Registration is guarded by defined( 'WP_POLLS_VERSION' ).

Answers arrive as readable text

Selected Answer(s) contains the answer text, comma-separated for multiple-choice polls, not the internal answer IDs. That means a spreadsheet row or Slack message reads correctly without a lookup.

Votes are anonymous

WP-Polls does not collect names or addresses. Visitor IP is the only identifier available.

Troubleshooting

Nothing fires

Confirm voting is actually AJAX-driven on your theme. Some heavily customised templates submit the poll form with a full page reload through a different code path.

Logged-in-only polls

If the poll is restricted to registered voters, visitors who are logged out are rejected before the vote is recorded, so no event dispatches.

Related docs