Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created April 21, 2022 13:27
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 Pebblo/b189b8360761973f27db75a2868f6e05 to your computer and use it in GitHub Desktop.
Save Pebblo/b189b8360761973f27db75a2868f6e05 to your computer and use it in GitHub Desktop.
Example of how to set EE events to have a default venue when created.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter('FHEE__EE_Form_Input_Base___construct__input_args', 'tw_ee_set_default_event_venue', 10, 2);
function tw_ee_set_default_event_venue( $input_args, $input_obj) {
if(
!empty($input_args['html_name'])
&& $input_args['html_name'] === 'venue_id'
&& $input_obj instanceof EE_Select_Input
) {
// If no venue has been set on the event, set a default venue to use.
if( $input_args['default'] == 0 ) {
$input_args['default'] = '235';
}
return $input_args;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment