Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Last active November 20, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzocaum/73efdcd1993e767728c7 to your computer and use it in GitHub Desktop.
Save lorenzocaum/73efdcd1993e767728c7 to your computer and use it in GitHub Desktop.
How to remove sold out, postponed, or cancelled events from the Events Calendar for Event Espresso 4

Add the sample code below to your child theme's functions.php file or in a site specific plugin and sold out events will be excluded from the events calendar. Uncomment (i.e. remove the //) for postponed and cancelled to hide those events from your events calendar as well.

<?php
//* Do NOT include the opening php tag

//* Exclude certain events from the events calendar for Event Espresso
function ee_hide_certain_event_statuses_from_events_calendar( $public_event_stati ) {
			unset( $public_event_stati[ EEM_Event::sold_out ] );
			// unset( $public_event_stati[ EEM_Event::postponed ] );
			// unset( $public_event_stati[ EEM_Event::cancelled ] );
			return $public_event_stati;
		}
add_filter( 'AFEE__EED_Espresso_Calendar__get_calendar_events__public_event_stati', 'ee_hide_certain_event_statuses_from_events_calendar', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment