Skip to content

Contact Form

Free built-in module. A simple contact form with Name, E-mail and Message fields, emailed to your site's admin address. It has a honeypot, Google reCAPTCHA v3, and optional phone and consent fields.

Open its settings from Conversations > Contact Form in the OG AI Core rail (admin.php?page=ogcfb_settings-menu). Each field saves as soon as you change it.

Contact Form settings

Note

Messages are emailed, not stored. To keep every enquiry in one place, use the Pro Leads module with your own forms, or send email through CoreMail with logging on.

Add the form

  • Block editor: add the Contact Form block. It supports wide and full alignment.
  • Shortcode: [og-contact-form-block]. The older [contact-form-block] still works.
[og-contact-form-block header="true" header_title="Get in Touch" button_text="Send"]

Shortcode attributes

Attribute Default
name_label Name
email_label E-mail
message_label Message
phone_label Phone (used when the phone field is on)
header false
header_title Get in Touch
header_text Leave your message and we'll get back to you shortly.
header_image_id
header_image_size 50
header_image_align left
button_text Send
button_color #0095ff
button_text_color white
align
theme default
message_rows 5

Settings

Card Field Option Default
Settings Success Message ogcfb_success_message Your message was sent successfully. Thank you!
Settings Redirect URL ogcfb_redirect_url
Settings Phone Field ogcfb_phone_field Off
Settings Consent ogcfb_consent_field Off
Settings Consent Text ogcfb_consent_text I have read and agree to the privacy policy.
Anti-Spam Honeypot ogcfb_honeypot On
Google Captcha v3 Public Key ogcfb_captcha_key
Google Captcha v3 Secret Key ogcfb_captcha_secret_key
E-mails Subject ogcfb_email_subject [*site*] Message from *name*
E-mails Content ogcfb_email_content Name, E-mail and message
E-mails HTML ogcfb_email_html Off

Consent Text allows links and simple formatting.

Spam protection

  • Honeypot: a hidden field bots tend to fill in, plus a signed time stamp. A form sent within 3 seconds of loading is refused.
  • reCAPTCHA v3: on as soon as a secret key is saved. Visitors with a score below 0.5 are refused.
  • Consent: when on, the box must be ticked. This is checked on the server too.

Email placeholders

Use these in Subject and Content:

*name*, *email*, *message*, *site*, *page_url*, *page_title*, *referrer*, *ip*, *user_agent*, *date*, plus *phone* and *consent* when those fields are on.

The email's Reply-To is the visitor's name and address, so you can answer straight from your inbox.

Developers

REST namespace og-contact-form-block/v1: POST /update_option and GET /all_settings. They are registered for administrators only and are used by the settings screen.

Hooks (arguments as passed):

Hook Arguments
ogcfb_atts array $atts, null, array $raw_atts
ogcfb_form_after_name, ogcfb_form_after_email, ogcfb_form_after_message string '', array $atts, string $css, $reply, string $formId
ogcfb_form_info string '', array $atts, string $formId, bool $success
ogcfb_form_html string $html, array $atts, string $formId, bool $success
ogcfb_form_read_data array $form
ogcfb_validate $error, array $form
ogcfb_email_to string $to, array $form
ogcfb_email_subject string $subject, array $form
ogcfb_email_content string $content, array $form
ogcfb_email_headers array $headers, array $form
ogcfb_email_placeholders array $placeholders, array $form, $context
ogcfb_fill_template string $content, array $form
ogcfb_client_ip string $ip
ogcfb_redirect_url string $url, bool $success, $error, array $form
ogcfb_form_sent (action) array $form. Fires after the email is handed to wp_mail().

Send form messages to the Leads screen:

add_action( 'ogcfb_form_sent', function ( $form ) {
    do_action( 'ogaie_lead_capture', [
        'source'  => 'contact_form',
        'form'    => 'Contact form',
        'name'    => $form['name'] ?? '',
        'email'   => $form['from'] ?? '', // the visitor's address
        'message' => $form['message'] ?? '',
    ] );
} );

MCP: the Forms tool set can read and change these settings (ogforms_update_contact_settings). See MCP tools.

Modules · AI Forms · Leads