Skip to content

Instantly share code, notes, and snippets.

@MattRyanCo
Created June 8, 2023 20:35
Show Gist options
  • Save MattRyanCo/377addcd7d9f5e186ba8cd535c6db0c2 to your computer and use it in GitHub Desktop.
Save MattRyanCo/377addcd7d9f5e186ba8cd535c6db0c2 to your computer and use it in GitHub Desktop.
Plugin to update honeypot on all Gravity Forms on your website.
<?php
/*
Plugin Name: Gravity Forms Honeypot Enabler
Description: Enables the honeypot setting for all Gravity Forms on your website.
Version: 1.0
Author: Your Name
*/
// Hook into WordPress initialization
add_action('init', 'enable_gravity_forms_honeypot');
function enable_gravity_forms_honeypot() {
// Check if Gravity Forms plugin is active
if (class_exists('GFForms')) {
// Get all forms
$forms = GFAPI::get_forms();
// Enable honeypot setting for each form
foreach ($forms as $form) {
$form['enableHoneypot'] = true;
GFAPI::update_form($form);
}
}
}
@MattRyanCo
Copy link
Author

ChatGPT generated on prompt "write a wordpress plugin that will go through all the gravity forms on my website and turn on the honeypot setting."
https://chat.openai.com/share/3ce348db-87dd-4c4b-b270-52147c2cdbba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment