WordPress filter hook · part of WordPress core

date_formats

A WordPress core filter that 14 plugins also fire themselves, running on 158K+ sites between them.

“Filters the default date formats.”

How to use date_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( 'date_formats', function( $value ) {
	// Change $value here.
	return $value;
}, 10, 1 );

Argument names come from BuddyPress'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 →

14 plugins that fire date_formats

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. BuddyPress icon BuddyPress90,000+ installs apply_filters( 'date_formats', array( __( 'F j, Y', 'buddypress' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php:664
  2. Kadence Central icon Kadence Central30,000+ installs apply_filters( 'date_formats', [ __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ] ) verbs/get-wordpress-settings.php:184
  3. MainWP Dashboard: Self-hosted WordPress Management for Agencies icon MainWP Dashboard: Self-hosted WordPress Management for Agencies20,000+ installs apply_filters( 'date_formats', array( esc_html__( 'F j, Y', 'mainwp' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) pages/page-mainwp-settings.php:1459
  4. Sugar Calendar icon Sugar Calendar10,000+ installs apply_filters( 'date_formats', [ 'F j, Y', 'Y-m-d', 'm/d/Y', 'd/m/Y', 'jS F, Y', ] ) includes/common/time.php:539
  5. bbp style pack icon bbp style pack6,000+ installs apply_filters( 'date_formats', array( __( 'F j, Y', 'bbp-style-pack' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) includes/settings_freshness_display.php:289
  6. Profile Extra Fields by BestWebSoft icon Profile Extra Fields by BestWebSoft1,000+ installs apply_filters( 'date_formats', array( 'F j, Y', 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) profile-extra-fields.php:1438
  7. WPCasa icon WPCasa1,000+ installs apply_filters( 'date_formats', array( 'F j, Y', 'j. F Y', 'Y-m-d', 'y-m-d', 'm/d/Y', 'm/d/y', 'd/m/Y', 'd/m/y', 'd.m.Y', 'd.m.y' ) ) includes/class-wpsight-general.php:493
  8. Advanced Posts Widget icon Advanced Posts Widget200+ installs apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) inc/class-advanced-posts-widget-fields.php:707
  9. Eazy Plugin Manager icon Eazy Plugin Manager80+ installs apply_filters( 'date_formats', array(__('F j, Y', 'eazy-plugin-manager'), 'Y-m-d', 'm/d/Y', 'd/m/Y') ) libs/class.rest_api.php:1157
  10. Convert Number in Tibetan icon Convert Number in Tibetan20+ installs apply_filters( 'date_formats', array(__('F j, Y'), 'Y-m-d', 'm/d/Y', 'd/m/Y', 'ཕྱི་ལོ། Y ཟླ། m ཚེས། d') ) inc/admin.php:32
  11. Simple blueprint installer icon Simple blueprint installer20+ installs apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) admin/class-simple-blueprint-installer-admin.php:295
  12. Bike Rental by BestWebSoft icon Bike Rental by BestWebSoft10+ installs apply_filters( 'date_formats', array( 'F j, Y', 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) bws_booking/classes/admin/bws_bkng_attributes_page.php:785
  13. WP Core Settings Reduction Project icon WP Core Settings Reduction ProjectFewer than 10 installs apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) replacements/options-general.php:278
  14. Warp Calendar Events icon Warp Calendar EventsFewer than 10 installs apply_filters( 'date_formats', array( 'F j, Y', 'Y-m-d', 'm/d/Y', 'd/m/Y', 'd.m.Y' ) ) includes/class-adminapi.php:110

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.