WordPress filter hook · part of WordPress core
time_formats
A WordPress core filter that 11 plugins also fire themselves, running on 127K+ sites between them.
“Filters the default time formats.”
How to use time_formats
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'time_formats', function( $value ) {
// Change $value here.
return $value;
}, 10, 1 );Argument names come from WP Maintenance's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
11 plugins that fire time_formats
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WP Maintenance60,000+ installs
apply_filters( 'time_formats', array( 'H:i' ) )views/wp-maintenance-countdown.php:77 -
Kadence Central30,000+ installs
apply_filters( 'time_formats', [ __( 'g:i a' ), 'g:i A', 'H:i' ] )verbs/get-wordpress-settings.php:198 -
MainWP Dashboard: Self-hosted WordPress Management for Agencies20,000+ installs
apply_filters( 'time_formats', array( esc_html__( 'g:i a', 'mainwp' ), 'g:i A', 'H:i' ) )pages/page-mainwp-settings.php:1499 -
Sugar Calendar10,000+ installs
apply_filters( 'time_formats', [ esc_html__( 'g:i a', 'sugar-calendar-lite' ), 'g:i A', 'H:i', ] )includes/common/time.php:569 -
bbp style pack6,000+ installs
apply_filters( 'time_formats', array( __( 'g:i a', 'bbp-style-pack' ), 'g:i A', 'H:i' ) )includes/settings_freshness_display.php:341 -
Profile Extra Fields by BestWebSoft1,000+ installs
apply_filters( 'time_formats', array( 'g:i a', 'g:i A', 'H:i' ) )profile-extra-fields.php:1464 -
Eazy Plugin Manager80+ installs
apply_filters( 'time_formats', array(__('g:i a', 'eazy-plugin-manager'), 'g:i A', 'H:i') )libs/class.rest_api.php:1166 -
Simple blueprint installer20+ installs
apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) )admin/class-simple-blueprint-installer-admin.php:296 -
Bike Rental by BestWebSoft10+ installs
apply_filters( 'time_formats', array( 'g:i a', 'g:i A', 'H:i' ) )bws_booking/classes/admin/bws_bkng_attributes_page.php:809 -
WP Core Settings Reduction ProjectFewer than 10 installs
apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) )replacements/options-general.php:311 -
Warp Calendar EventsFewer than 10 installs
apply_filters( 'time_formats', array( 'g:i a', 'g:i A', 'H:i' ) )includes/class-adminapi.php:111
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.