Retrieves the most recent time that a post on the site was published.
Description
The server timezone is the default and is the difference between GMT and server time. The ‘blog’ value is the date when the last post was posted.
The ‘gmt’ is when the last post was posted in GMT formatted date.
Parameters
$timezone
stringoptional- The timezone for the timestamp. Accepts
'server'
,'blog'
, or'gmt'
.
'server'
uses the server’s internal timezone.
'blog'
uses thepost_date
field, which proxies to the timezone set for the site.
'gmt'
uses thepost_date_gmt
field.
Default'server'
.Default:
'server'
$post_type
stringoptional- The post type to check. Default
'any'
.Default:
'any'
Source
// Only need to check the cap if $public_only is false.
$post_status_sql = "post_status = 'publish'";
if ( false === $public_only ) {
if ( $cap ) {
// Does the user have the capability to view private posts? Guess so.
$post_status_sql .= " OR post_status = 'private'";
} elseif ( is_user_logged_in() ) {
// Users can view their own private posts.
$id = get_current_user_id();
if ( null === $post_author || ! $full ) {
$post_status_sql .= " OR post_status = 'private' AND post_author = $id";
} elseif ( $id === (int) $post_author ) {
$post_status_sql .= " OR post_status = 'private'";
} // Else none.
} // Else none.
User Contributed Notes
You must log in before being able to contribute a note or feedback.