Title: wp_checkdate
Published: April 25, 2014
Last modified: August 20, 2026

---

# wp_checkdate( int $month, int $day, int $year, string $source_date ): bool

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#wp--skip-link--target)

Tests if the supplied date is valid for the Gregorian calendar.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#parameters)󠁿

 `$month`intrequired

Month number.

`$day`intrequired

Day number.

`$year`intrequired

Year number.

`$source_date`stringrequired

The date to filter.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#return)󠁿

 bool True if valid date, false if not valid date.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#source)󠁿

    ```php
    function wp_checkdate( $month, $day, $year, $source_date ) {
    	$checkdate = false;
    	if ( is_numeric( $month ) && is_numeric( $day ) && is_numeric( $year ) ) {
    		$checkdate = checkdate( (int) $month, (int) $day, (int) $year );
    	}

    	/**
    	 * Filters whether the given date is valid for the Gregorian calendar.
    	 *
    	 * @since 3.5.0
    	 *
    	 * @param bool   $checkdate   Whether the given date is valid.
    	 * @param string $source_date Date to check.
    	 */
    	return apply_filters( 'wp_checkdate', $checkdate, $source_date );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/functions.php#L7527)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/functions.php#L7527-L7542)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#hooks)󠁿

 [apply_filters( ‘wp_checkdate’, bool $checkdate, string $source_date )](https://developer.wordpress.org/reference/hooks/wp_checkdate/)

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

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#related)󠁿

| Uses | Description | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [wp_resolve_post_date()](https://developer.wordpress.org/reference/functions/wp_resolve_post_date/)`wp-includes/post.php` |

Uses wp_checkdate to return a valid Gregorian-calendar value for post_date.

  | 
| [wp_validate_site_data()](https://developer.wordpress.org/reference/functions/wp_validate_site_data/)`wp-includes/ms-site.php` |

Validates data for a site prior to inserting or updating in the database.

  | 
| [WP_Date_Query::validate_date_values()](https://developer.wordpress.org/reference/classes/wp_date_query/validate_date_values/)`wp-includes/class-wp-date-query.php` |

Validates the given date_query values and triggers errors if something is not valid.

  | 
| [_wp_translate_postdata()](https://developer.wordpress.org/reference/functions/_wp_translate_postdata/)`wp-admin/includes/post.php` |

Renames `$_POST` data from form names to DB post columns.

  | 
| [WP_Customize_Manager::save()](https://developer.wordpress.org/reference/classes/wp_customize_manager/save/)`wp-includes/class-wp-customize-manager.php` |

Handles customize_save WP Ajax request to save/update a changeset.

  | 
| [WP_Query::parse_query()](https://developer.wordpress.org/reference/classes/wp_query/parse_query/)`wp-includes/class-wp-query.php` |

Parses a query string and sets query type booleans.

  | 
| [redirect_canonical()](https://developer.wordpress.org/reference/functions/redirect_canonical/)`wp-includes/canonical.php` |

Redirects incoming links to the proper URL based on the site url.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/wp_checkdate/?output_format=md#comment-content-2840)
 2.   [Juri](https://profiles.wordpress.org/rudijuri/)  [  8 years ago  ](https://developer.wordpress.org/reference/functions/wp_checkdate/#comment-2840)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_checkdate%2F%23comment-2840)
    Vote results for this note: -1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_checkdate%2F%23comment-2840)
 4. “checkdate” link, in description section ([https://developer.wordpress.org/reference/functions/wp_checkdate/#see-also](https://developer.wordpress.org/reference/functions/wp_checkdate/#see-also)),
    is broken
 5.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_checkdate%2F%3Freplytocom%3D2840%23feedback-editor-2840)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_checkdate%2F)
before being able to contribute a note or feedback.