Skip to content

Instantly share code, notes, and snippets.

@alexwcoleman
Created October 4, 2018 22:27
Show Gist options
  • Save alexwcoleman/8d581ac12f028c5754c52021b30dc202 to your computer and use it in GitHub Desktop.
Save alexwcoleman/8d581ac12f028c5754c52021b30dc202 to your computer and use it in GitHub Desktop.
Adding Custom Endpoints to The Events Calendar
// this filter adds the custom field values to the json output for The Events Calendar
// https://theeventscalendar.com/support/forums/topic/custom-field-output-for-json-feed/
add_filter( 'tribe_rest_event_data', 'omfg_add_event_customfields' );
function omfg_add_event_customfields($data) {
$event_id = $data['id'];
$some_data = 'some data';
$data = array_merge( $data,
// This is for a single value
array('band_id' => $some_data,
));
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment