How to delete an expired event by time

How to delete an expired event by time

In Order to display an event as Expired after a specific date and time, you need to add the following code to your theme functions.php file.

  1. Open your child theme,
  2. Add the code into the funtions.php file.
/* Event Expire by time */
function my_cron_schedules($schedules){
      if(!isset($schedules["5min"])){
        $schedules["5min"] = array( 'interval' => 560, 'display' => __('Once every 5 minutes'));    }
    }
    return $schedules;
}
add_filter('cron_schedules','my_cron_schedules');
function schedule_my_cron($args){
wp_schedule_event(time(), '5min', 'my_schedule_hook');
}








  1. Next, create one field with the field type “Time” in the field editor at the admin panel.
  2. This would be visible on the event submission form, from where you can mention the time at which the event must expire.
    • Related Articles

    • Event Detail Page

      The Event detail page carries various details of a particular event. These details include the event title, event type, event location, event start date & time, event end date & time, event description, etc. besides this, you can also get the details ...
    • Editing Event Submission Form Fields

      There are mainly 2 ways to customize the form fields in WP Event Manager : Using the Field editor option from the admin panel. Using the WordPress hooks (filters) which are explained below. Using the field editor option from the admin panel To add, ...
    • Installation of WP Event Manager

      Automatic Installation of FREE WP Event Manager Installing WP Event Manager is just a matter of a few clicks. You can add WP Event Manager to your website by using the dashboard offered to you at the backend of the CMS. To install the plugin ...
    • Event listings not showing up in the [events] page

      The most common reason behind this particular issue is an error in the Java Script as events are loaded through Ajax. To debug the Javascript error when the event listings are not displayed, you need to pass through the following steps: Go to your ...
    • Changing the event slug/permalink

      In this guide, we will show you how you can change or customize the event slug or permalink. It usually appears like this: http://yoursite.com/events/event-listing-title in the default settings. To customize this with WP Event Manager, you can use ...