get_lastcommentmodified()
get_lastcommentmodified( string $timezone = ‘server’ ) …
get_lastcommentmodified( string $timezone = ‘server’ )
上次修改评论的日期。
The date the last comment was modified.
目录锚点:#参数#返回#源码
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$timezone | (string) | 可选 | 引用“gmt”、“blog”或“server”位置时使用的时区。 |
返回(Return)
(string|false)成功时的最后一条注释修改日期,失败时为false。
源码(Source)
/** * The date the last comment was modified. * * @since 1.5.0 * * @global wpdb $wpdb WordPress database abstraction object. * @staticvar array $cache_lastcommentmodified * * @param string $timezone Which timezone to use in reference to 'gmt', 'blog', * or 'server' locations. * @return string Last comment modified date. */ function get_lastcommentmodified($timezone = 'server') { global $wpdb; static $cache_lastcommentmodified = array(); if ( isset($cache_lastcommentmodified[$timezone]) ) return $cache_lastcommentmodified[$timezone]; $add_seconds_server = date('Z'); switch ( strtolower($timezone)) { case 'gmt': $lastcommentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1"); break; case 'blog': $lastcommentmodified = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1"); break; case 'server': $lastcommentmodified = $wpdb->get_var($wpdb->prepare("SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server)); break; } $cache_lastcommentmodified[$timezone] = $lastcommentmodified; return $lastcommentmodified; }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
4.7.0 | wp-includes/comment.php:323 | 1 function | 4 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
还没有任何评论,赶紧来占个楼吧!