Docs: Clarify that `get_lastpostdate()` and `get_lastpostmodified()` can return `false` on failure.

The both use `_get_last_post_time()` internally.

Props Rarst.
See #48957.
Built from https://develop.svn.wordpress.org/trunk@46973


git-svn-id: http://core.svn.wordpress.org/trunk@46773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-12-17 20:26:01 +00:00
parent bbd898b1dd
commit 8eb278d19a
2 changed files with 11 additions and 10 deletions

View File

@ -6392,7 +6392,7 @@ function get_posts_by_author_sql( $post_type, $full = true, $post_author = null,
* 'gmt' uses the `post_date_gmt` field. * 'gmt' uses the `post_date_gmt` field.
* Default 'server'. * Default 'server'.
* @param string $post_type Optional. The post type to check. Default 'any'. * @param string $post_type Optional. The post type to check. Default 'any'.
* @return string The date of the last post. * @return string The date of the last post, or false on failure.
*/ */
function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) { function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) {
/** /**
@ -6400,7 +6400,7 @@ function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) {
* *
* @since 2.3.0 * @since 2.3.0
* *
* @param string $date Date the last post was published. * @param string|false $date Date the last post was published. False on failure.
* @param string $timezone Location to use for getting the post published date. * @param string $timezone Location to use for getting the post published date.
* See get_lastpostdate() for accepted `$timezone` values. * See get_lastpostdate() for accepted `$timezone` values.
*/ */
@ -6421,7 +6421,7 @@ function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) {
* for information on accepted values. * for information on accepted values.
* Default 'server'. * Default 'server'.
* @param string $post_type Optional. The post type to check. Default 'any'. * @param string $post_type Optional. The post type to check. Default 'any'.
* @return string The timestamp in 'Y-m-d H:i:s' format. * @return string The timestamp in 'Y-m-d H:i:s' format, or false on failure.
*/ */
function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) { function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) {
/** /**
@ -6452,7 +6452,8 @@ function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) {
* *
* @since 2.3.0 * @since 2.3.0
* *
* @param string $lastpostmodified The most recent time that a post was modified, in 'Y-m-d H:i:s' format. * @param string|false $lastpostmodified The most recent time that a post was modified, in 'Y-m-d H:i:s' format.
* False on failure.
* @param string $timezone Location to use for getting the post modified date. * @param string $timezone Location to use for getting the post modified date.
* See get_lastpostdate() for accepted `$timezone` values. * See get_lastpostdate() for accepted `$timezone` values.
*/ */
@ -6472,7 +6473,7 @@ function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) {
* for information on accepted values. * for information on accepted values.
* @param string $field Post field to check. Accepts 'date' or 'modified'. * @param string $field Post field to check. Accepts 'date' or 'modified'.
* @param string $post_type Optional. The post type to check. Default 'any'. * @param string $post_type Optional. The post type to check. Default 'any'.
* @return string|false The timestamp in 'Y-m-d H:i:s' format, or false on error. * @return string|false The timestamp in 'Y-m-d H:i:s' format, or false on failure.
*/ */
function _get_last_post_time( $timezone, $field, $post_type = 'any' ) { function _get_last_post_time( $timezone, $field, $post_type = 'any' ) {
global $wpdb; global $wpdb;

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-alpha-46972'; $wp_version = '5.4-alpha-46973';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.