不久发了一篇文章,瞅了一眼 ,時间显示信息是8小时前,什么玩意?我穿越重生到过去?之前就碰到已过,但是一直不想解决 ,今日就解决一下,顺带纪录下 。

第一查验了车内仪表盘 – 设定 -基本,时区设定 全是沒有难题的。

又查验了网络服务器的時间 ,都是沒有难题的,Google了下有关的词,发觉改动下文档就可以。

wp-includes\functions.php 搜索下列编码:

  1. function current_time( $type$gmt = 0 ) {
  2.     switch ( $type ) {
  3.         case 'mysql':
  4.             return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );
  5.         case 'timestamp':
  6.             return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
  7.         default:
  8.             return ( $gmt ) ? date$type ) : date$type, time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
  9.     }
  10. }

换为:

  1. function current_time( $type$gmt = 8 ) {
  2.     switch ( $type ) {
  3.         case 'mysql':
  4.             return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );
  5.         case 'timestamp':
  6.             return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
  7.         default:
  8.             return ( $gmt ) ? date$type ) : date$type, time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
  9.     }
  10. }

就可以 。

简易的讲就是说把 wp-includes\functions.php

function current_time( $type, $gmt = 0 ) {

改成

function current_time( $type, $gmt = 8 ) {

0改成8

 

 


 

2017-11-16更:

左右的办法历经检测 ,发觉更新后又变成提前8小时了 ,在网上一些作法发把时区改成UTC+8因为我试已过,都是不好。

最终在一个群内,一个朋友说把时区改成纽约就可以 ,随后确实就行了...

< alt="处理 wordpress 公布時间显示信息提前8小时的办法" class="alignnone size-full wp-image-4315" height="265" sizes="(max-width: 867px) 100vw, 867px" src="https://.laod.cn/wp-content/uploads/2017/08/lundun.png" ="https://.laod.cn/wp-content/uploads/2017/08/lundun.png 867w, https://.laod.cn/wp-content/uploads/2017/08/lundun-768x235.png 768w" width="867"/>

问起为何?她说:“涉及地理常识 我也无需多言了...”

随后我谷歌搜索引擎了下,伦敦时间比北京市慢8小时

< alt="处理 wordpress 公布時间显示信息提前8小时的办法" class="alignnone size-full wp-image-4316" height="143" src="https://.laod.cn/wp-content/uploads/2017/08/lun.png" width="536"/>

本文版权归趣快排www.sEoguruBlog.com 所有,如有转发请注明来出,竞价开户托管,seo优化请联系QQ✈61910465