2805 | | $mm = substr( $post_date, 5, 2 ); |
2806 | | $jj = substr( $post_date, 8, 2 ); |
2807 | | $aa = substr( $post_date, 0, 4 ); |
2808 | | $valid_date = wp_checkdate( $mm, $jj, $aa, $post_date ); |
| 2805 | preg_match("/^(?P<year>\d{4})-(?P<month>0?[1-9]|1[012])-(?P<day>0?[1-9]|[12][0-9]|3[01])/", $post_date, $matches); |
| 2806 | |
| 2807 | $valid_date = false; |
| 2808 | if ( count( $matches ) >= 6 ) // Each capture group in the REGEX creates two array elements |
| 2809 | $valid_date = wp_checkdate( (int) $matches['month'], (int) $matches['day'], (int) $matches['year'], $post_date ); |
| 2810 | |