Skip to content

Instantly share code, notes, and snippets.

@elimn
Last active February 23, 2020 22:42
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 elimn/5712dcc4d3cbbfacc0ed to your computer and use it in GitHub Desktop.
Save elimn/5712dcc4d3cbbfacc0ed to your computer and use it in GitHub Desktop.
MT | TEC | Escape characters in Events Calendar date format
<?php
/*
* This allows you to escape characters in TEC date formats
*
* Example date format: F \d\e j, Y
* Example date: dezembro de 31, 2014
* http://codex.wordpress.org/Formatting_Date_and_Time#Escaping
*
* You can change these formats in WP Admin > Events > Settings > Display
*/
function tribe_escape_date_format ($value, $optionName, $default) {
if(
$optionName == 'dateWithYearFormat' ||
$optionName == 'dateWithoutYearFormat' ||
$optionName == 'monthAndYearFormat' ||
$optionName == 'weekDayFormat'
) {
$value = stripslashes($value);
}
return $value;
}
add_filter( 'tribe_get_option', 'tribe_escape_date_format', 100, 3 );
@agustinbarrientos
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment