Created
June 8, 2023 20:35
-
-
Save MattRyanCo/377addcd7d9f5e186ba8cd535c6db0c2 to your computer and use it in GitHub Desktop.
Plugin to update honeypot on all Gravity Forms on your website.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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