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. git-svn-id: https://develop.svn.wordpress.org/trunk@46973 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ed3e924683
commit
9d69e005ea
@ -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,9 +6400,9 @@ 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.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date', $post_type ), $timezone );
|
return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date', $post_type ), $timezone );
|
||||||
}
|
}
|
||||||
@ -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,9 +6452,10 @@ 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.
|
||||||
* @param string $timezone Location to use for getting the post modified date.
|
* False on failure.
|
||||||
* See get_lastpostdate() for accepted `$timezone` values.
|
* @param string $timezone Location to use for getting the post modified date.
|
||||||
|
* See get_lastpostdate() for accepted `$timezone` values.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
|
return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
|
||||||
}
|
}
|
||||||
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user