On this page
wp_checkdate( int $month, int $day, int $year, string $source_date ): bool
Tests if the supplied date is valid for the Gregorian calendar.
Parameters
$monthint Required-
Month number.
$dayint Required-
Day number.
$yearint Required-
Year number.
$source_datestring Required-
The date to filter.
Return
bool True if valid date, false if not valid date.
Source
File: wp-includes/functions.php. View all references
function wp_checkdate( $month, $day, $year, $source_date ) {
/**
* 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( $month, $day, $year ), $source_date );
}
Hooks
- apply_filters( 'wp_checkdate',
bool $checkdate ,string $source_date ) -
Filters whether the given date is valid for the Gregorian calendar.
Related
Uses
| Uses | Description |
|---|---|
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| 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() wp-includes/ms-site.php | Validates data for a site prior to inserting or updating in the database. |
| 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() wp-admin/includes/post.php | Renames |
| 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() wp-includes/class-wp-query.php | Parse a query string and set query type booleans. |
| redirect_canonical() wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
Changelog
| Version | Description |
|---|---|
| 3.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_checkdate