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:

functions.php
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.

  1. WP Maintenance icon WP Maintenance60,000+ installs apply_filters( 'time_formats', array( 'H:i' ) ) views/wp-maintenance-countdown.php:77
  2. Kadence Central icon Kadence Central30,000+ installs apply_filters( 'time_formats', [ __( 'g:i a' ), 'g:i A', 'H:i' ] ) verbs/get-wordpress-settings.php:198
  3. MainWP Dashboard: Self-hosted WordPress Management for Agencies icon 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
  4. Sugar Calendar icon 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
  5. bbp style pack icon 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
  6. Profile Extra Fields by BestWebSoft icon 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
  7. Eazy Plugin Manager icon 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
  8. Simple blueprint installer icon 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
  9. Bike Rental by BestWebSoft icon 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
  10. WP Core Settings Reduction Project icon 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
  11. Warp Calendar Events icon 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.