• We have hundreds of events per month in our calendar, and I would like for them to become unpublished or removed after their date has pass. I know you can remove the link, but the link is not currently being used, but rather custom code so it reflects our branding on the site.

Viewing 1 replies (of 1 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    I’ve added a filter that runs when fetching events that would allow you to write custom code to delete or otherwise modify events after they’re over. It’ll be in the next released version.

    The filter is mc_event_object and is run after an event is fetched from the database for display and the object is instantiated. At that time, you can write code to inspect the event to see if it has ended and execute whatever custom code you need to. E.g.

    function delete_my_events( $event ) {
         $end_date = strtotime( $event->occur_end );
         if ( $end_date < time() ) {
              mc_delete_event( $event->event_id );
    
              return false;
         }
    
         return $event;
    }
    add_filter( 'mc_event_object', 'delete_my_events', 10, 1 );

    (Warning: the above is *not* tested.)

Viewing 1 replies (of 1 total)

The topic ‘Remove events after date’ is closed to new replies.