WPForms Settings Page

Registering new settings pages is very straightforward with WPForms. Here’s a screenshot of what it looks like:

Here’s the code to register the settings page:

 * Schedule Settings
function ea_schedule_settings( $sections, $form_data ) {
    $sections['mct_schedule'] = __( 'MCT Schedule', 'ea' );
    return $sections;
add_filter( 'wpforms_builder_settings_sections', 'ea_schedule_settings', 20, 2 );

 * Schedule Settings Content
function ea_schedule_settings_content( $instance ) {

    echo '<div class="wpforms-panel-content-section wpforms-panel-content-section-mct_schedule">';
    echo '<div class="wpforms-panel-content-section-title">' . __( 'MCT Schedule', 'ea' ) . '</div>';

    // Zip Code
        __( 'Zip Codes (one per line)', 'ea' ),
        array( 'rows' => 20 )

    echo '</div>';
add_filter( 'wpforms_form_settings_panel_content', 'ea_schedule_settings_content', 20 );

This data is then accessible inside of the $form_data. Here’s how I’m using it within my form: $zipcodes = explode( PHP_EOL, $form_data['settings']['mtc_zip_codes'] );

Most of the WPForms filters will include the $form_data. Here’s how to access that data outside the context of a WPForms filter (change 1234 to your Form ID):

$form = wpforms()->form->get( 1234 );
$form_data = wpforms_decode( $form->post_content );
$booked = explode( PHP_EOL, $form_data['settings']['mct_booked_times'] );

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk