WordPress filter hook · part of WordPress core

wp_checkdate

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

“Filters whether the given date is valid for the Gregorian calendar.”

How to use wp_checkdate

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'wp_checkdate', function( $retval, $source_date ) {
	// Change $retval here.
	return $retval;
}, 10, 2 );

Argument names come from Easy Digital Downloads'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 →

5 plugins that fire wp_checkdate

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

  1. Easy Digital Downloads icon Easy Digital Downloads40,000+ installs apply_filters( 'wp_checkdate', $retval, $source_date ) src/Database/Queries/Date.php:1283
  2. Sugar Calendar icon Sugar Calendar10,000+ installs apply_filters( 'wp_checkdate', $retval, $source_date ) includes/classes/database/engine/Queries/Date.php:1315
  3. Stripe Payment Forms by WP Simple Pay icon Stripe Payment Forms by WP Simple Pay8,000+ installs apply_filters( 'wp_checkdate', $retval, $source_date ) lib/BerlinDB/Database/Queries/Date.php:1315
  4. Tablesome Table icon Tablesome Table7,000+ installs apply_filters( 'wp_checkdate', $retval, $source_date ) includes/lib/berlin-db/core/date.php:1315
  5. Plays Block icon Plays Block40+ installs apply_filters( 'wp_checkdate', $retval, $source_date ) includes/core/engine/Queries/Date.php:1316

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.