Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
MT - TEC PRO - Assign a default value for specific Additional Fields
* MT - TEC PRO - Display a default value for an Additional Field
* from
* for
* @return array
function cliff_tec_pro_default_additional_field_values( $data ) {
// NOTE: if an array key from $defaults does not exist in $data, it will still be inserted and therefore could give the appearance of creating a brand new Additional Field even if it doesn't exist at wp-admin > Events > Settings > Additional Fields tab.
$defaults = array(
'Additional Field Name' => 'Custom default value here',
'New Text Field for Testing' => 'APERTURA LOCALE (GIO-VEN-SAB ORE 19.30 / DOM ORE 18.00)INIZIO LIVE 22.00',
// avoid potential for odd error -- shouldn't happen
if ( ! is_array( $data ) ) {
return $data;
$new_data = array_merge( $defaults, $data );
// Put the Additional Fields in alpha-order by their keys, not their values
ksort( $new_data, SORT_NATURAL );
return $new_data;
add_filter( 'tribe_get_custom_fields', 'cliff_tec_pro_default_additional_field_values' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment