Skip to content

Instantly share code, notes, and snippets.

@slimndap
Last active August 29, 2015 14:23
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 slimndap/9b7c0730a5f9bcf80ada to your computer and use it in GitHub Desktop.
Save slimndap/9b7c0730a5f9bcf80ada to your computer and use it in GitHub Desktop.
Removes 'End time' and all tickets field from the event editor.
/**
* Removes 'End time' and all tickets fields from the event editor.
*
* @param array $fields The current fields of the event editor.
* @param int $event_id The event being edited.
* @return array The new fields of the event editor.
*/
function remove_event_editor_fields($fields, $event_id) {
$new_fields = array();
$remove_fields = array( 'enddate', 'tickets_status', 'tickets_url', 'tickets_button', '_wpt_event_tickets_price' );
foreach ($fields as $field) {
if (!in_array($field['id'], $remove_fields)) {
$new_fields[] = $field;
}
}
return $new_fields;
}
add_filter( 'wpt/event_editor/fields', 'remove_event_editor_fields', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment