Skip to content
WordPress Events Calendar
  • FeaturesExpand
    • Monthly calendar view
    • List view
    • Daily agenda view
    • Event management
    • Venues and organizers
    • Timezones and all-day events
    • Gutenberg block
    • Add to Calendar
    • Categories and tags
    • Google Calendar import
    • Event submissions
  • Live Demo
  • DocsExpand
    • Installation
    • Creating events
    • Shortcode and block
    • Switch from The Events Calendar
    • Import a calendar
    • Troubleshooting
    • Event submissions
    • Page builders
    • Translation
  • CompareExpand
    • vs The Events Calendar
    • vs Modern Events Calendar
    • vs Sugar Calendar
  • Blog
  • Download free
WordPress Events Calendar

Home / Docs / Create Events from Other Forms and Code

Create events from other forms and code

Monthly Events Calendar has its own Submit an Event form. If you’d rather use a form you already have, this page shows how to create an event from Gravity Forms, another form plugin or your own code. You need version 1.8 or newer, and somewhere to put a PHP snippet (a code snippets plugin or your child theme).

One function: ecwp_submit_event()

$event_id = ecwp_submit_event( array(
    'title'           => 'Jazz night',           // required
    'description'     => 'Live music from 8pm.',
    'start'           => '2026-12-05 20:00',     // required
    'end'             => '2026-12-05 23:00',
    'all_day'         => false,
    'timezone'        => 'Europe/London',        // default: your site's timezone
    'venue_name'      => 'Town Hall',            // reused if it exists, otherwise created
    'venue_address'   => '1 High St',
    'category'        => array( 'music' ),       // existing categories: IDs, slugs or names
    'website'         => 'https://example.com',
    'submitter_name'  => 'Gia',                  // needed when nobody is logged in
    'submitter_email' => 'gia@example.org',      // needed when nobody is logged in
    'source'          => 'my-form',
) );

It returns the new event’s ID, or a WP_Error explaining what was wrong.

Dates and times. Dates are YYYY-MM-DD. Times are 18:30 or 6:30 pm. Instead of start and end you can pass start_date, start_time, end_date and end_time separately, which is usually easier with form fields.

The same rules apply. The settings under Events Calendar → Submissions decide whether the current user may submit, whether the event is published or waits for approval, and which emails are sent.

Example: Gravity Forms

This creates an event each time form 5 is submitted. Replace the form ID and the field IDs with your own.

add_action( 'gform_after_submission_5', function ( $entry ) {
    ecwp_submit_event( array(
        'title'           => rgar( $entry, '1' ),
        'description'     => rgar( $entry, '2' ),
        'start_date'      => rgar( $entry, '3' ), // YYYY-MM-DD
        'start_time'      => rgar( $entry, '4' ), // 18:30 or 6:30 pm
        'venue_name'      => rgar( $entry, '5' ),
        'submitter_name'  => rgar( $entry, '6' ),
        'submitter_email' => rgar( $entry, '7' ),
        'source'          => 'gravityforms',
    ) );
} );

Test this on a staging site with your own form first. Check in particular that your date and time fields arrive in the formats above.

Other form plugins

Any form plugin that runs a PHP action after a submission can do the same: call ecwp_submit_event() inside that action and pass your fields. WPForms uses wpforms_process_complete and Formidable Forms uses frm_after_create_entry. Each plugin hands over dates and times in its own way, so convert them to YYYY-MM-DD and HH:MM before passing them on.

Two things every form must respect

  • Forms open to visitors: turn on Let visitors submit events without logging in under Events Calendar → Submissions, and pass submitter_name and submitter_email. Otherwise the function answers “Please log in to submit an event”.
  • Show failures: check the result with is_wp_error() if your form should tell the person something went wrong.

REST API

POST /wp-json/ecwp/v1/submissions accepts the same fields as form data or JSON: title, description, start_date, start_time, end_date, end_time, all_day, timezone, venue_name, venue_address, category, website, name, email and image (a file). Logged-in requests need the X-WP-Nonce header. It answers 201 with the event’s id, status, message and link.

Hooks

The most useful ones:

HookUse it to
ecwp_can_submit_event (filter)Decide who may submit
ecwp_submission_errors (filter)Refuse a submission with your own rule
ecwp_submission_status (filter)Force pending or publish
ecwp_submission_email (filter)Change or stop an email
ecwp_event_submitted (action)Run code after an event is submitted
ecwp_submission_approved / ecwp_submission_rejected (actions)Run code after a decision
ecwp_submit_form_start / ecwp_submit_form_end (actions)Add fields to the built-in form, for example a CAPTCHA

More for developers: Developer docs

WordPress Events Calendar
  • Switch from The Events Calendar
  • About
  • Changelog
  • Roadmap
  • Support

© 2026 WP Monthly Events

Scroll to top
  • Features
    • Monthly calendar view
    • List view
    • Daily agenda view
    • Event management
    • Venues and organizers
    • Timezones and all-day events
    • Gutenberg block
    • Add to Calendar
    • Categories and tags
    • Google Calendar import
    • Event submissions
  • Live Demo
  • Docs
    • Installation
    • Creating events
    • Shortcode and block
    • Switch from The Events Calendar
    • Import a calendar
    • Troubleshooting
    • Event submissions
    • Page builders
    • Translation
  • Compare
    • vs The Events Calendar
    • vs Modern Events Calendar
    • vs Sugar Calendar
  • Blog
  • Download free