Menu

How to Use the `bricks/form/custom_action` Hook in Bricks Builder
📰
0

How to Use the `bricks/form/custom_action` Hook in Bricks Builder

DEV Community·Muazzam·about 1 month ago
#DrJKeb1s
Reading 0:00
15s threshold

How to Use the bricks/form/custom_action Hook in Bricks Builder You can run custom PHP code after a Bricks Builder form submission using the bricks/form/custom_action hook. This is ideal if you need to send emails, save entries, or connect with external services. Step 1: Set Up the Form Action In your Bricks Builder form settings, go to "Actions after successful form submit" and select Custom . Step 2: Write Your PHP Logic Add this code to your theme's functions.php file or use a WordPress code snippets plugin. // Hook your function to the Bricks custom action add_action ( 'bricks/form/custom_action' , 'my_form_custom_action' , 10 , 1 ); function my_form_custom_action ( $form ) { // Get all submitted form fields as an array $fields = $form -> get_fields (); // Example: ['name' => 'Jane', 'email' => 'jane@example.com'] // Always check the form ID so your code only runs for the intended form $form_id = isset ( $fields [ 'formId' ]) ?…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More