How to Add a Custom Event Status
Last Updated: September 20, 2023
Since EventON 4.5, we added a new pluggable filter to allow you to extend the following list of available event statuses:
- Scheduled
- Cancelled
- Moved Online
- Postponed
- Rescheduled
- Preliminary
- Tentative
In this guide, we’ll cover how to add two new statuses “Sold Out” and “Pending Approval”.
To get started, please open your theme editor by going to Appearance > Theme File Editor and paste the following code into the functions.php file:
/**
* Add custom EventON statuses for your events
*
* @since EventON 4.5
*
* @return array
*/
add_filter( 'evo_event_statuses', 'my_custom_evo_event_status' );
function my_custom_evo_event_status( $statuses ) {
// Add a 'sold out' and 'pending approval' event status
$new_statuses = array(
'sold_out'=>array(evo_lang('Sold Out'), __('Sold Out','eventon') ),
'pending_approval'=>array(evo_lang('Pending Approval'), __('Pending Approval','eventon') )
);
return array_merge($statuses, $new_statuses);
}
In case you’d like to protect your code from future theme updates, please create a new PHP snippet using the Code Snippets Plugin or the WPCode Plugin.
Once the code has been successfully saved on your site, the new statuses should be visible when editing new and old events as shown below:
Did this article help you?