How can we help?
Remove the Preview Step
In this guide, you will learn about how you can remove the preview step in the Event Submission form.
The event submission process can be simplified by removing the preview steps.
You need to do the following things:
- Remove the Preview step.
- Change preview text to ‘Submit Event’.
- Manually publish events (from the admin panel or based on settings, it will auto publish).
Add the following code to your functions.php to accomplish that:
/** * Remove the preview step. Code goes in theme functions.php or a custom plugin. * @param array $steps * @return array */ function custom_submit_event_steps( $steps ) { unset( $steps['preview'] ); return $steps; } add_filter( 'submit_event_steps', 'custom_submit_event_steps' ); /** * Change button text */ function change_preview_text() { return __( 'Submit Event','wp-event-manager' ); } add_filter( 'submit_event_form_submit_button_text', 'change_preview_text' ); /** * Since we removed the preview step and its handler, we need to manually publish events * @param int $event_id */ function submit_event_without_preview_step( $event_id ) { $event = get_post( $event_id ); if ( in_array( $event->post_status, array( 'preview', 'expired' ) ) ) { // Reset expiry date delete_post_meta( $event->ID, '_event_expiry_date' ); // Update event listing $update_event = array(); $update_event['ID'] = $event->ID; $update_event['post_status'] = get_option( 'event_manager_submission_requires_approval' ) ? 'pending' : 'publish'; $update_event['post_date'] = current_time( 'mysql' ); $update_event['post_date_gmt'] = current_time( 'mysql', 1 ); wp_update_post( $update_event ); } } add_action( 'event_manager_event_submitted', 'submit_event_without_preview_step' );