Clarify that get_the_date(), get_the_time(), get_post_time() and get_post_modified_time() should return false when get_post() is null.

Adds unit tests.

Props GaryJ, SergeyBiryukov, tollmanz.
Fixes #28310.


git-svn-id: https://develop.svn.wordpress.org/trunk@29344 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-08-01 18:39:22 +00:00
parent 8b45f96cba
commit 91517ce620
3 changed files with 183 additions and 9 deletions

View File

@@ -21,7 +21,7 @@ require( ABSPATH . WPINC . '/option.php' );
* @param string $format Format of the date to return.
* @param string $date Date string to convert.
* @param bool $translate Whether the return date should be translated. Default true.
* @return string|int Formatted date string, or Unix timestamp.
* @return string|int|bool Formatted date string or Unix timestamp. False if $date is empty.
*/
function mysql2date( $format, $date, $translate = true ) {
if ( empty( $date ) )