解决 WordPress 无法自动检查更新

By | 2014年4月19日

自 wordpress 3.7开始,自动更新已经默认开启。小版本更新将全自动运行,无需人工干预。但在 reizhi 的博客却遇到了一些问题,wordpress 不但无法自动更新,在更新界面也看不到最新的版本信息。如下图所示,下载后本应显示服务器端最新版本号,但在此只显示了一个横线。起初以为是版本号丢失,但查看 wordpress 后台底部却能够正确显示当前版本。重装过数次虽然能短暂解决,过一段时间之后又再次出现。 

  

经过一番 Google ,确认该问题是由于 wordpress 主题中加入了禁止更新的代码所致。打开主题所在的 functions.php文件,搜索”core_updates”,删除”add_filter( ‘auto_update_core’, ‘__return_false’ );”即可。

除此之外,还有以下代码可关闭相应的 wordpress 更新功能。

add_filter( ‘allow_minor_auto_core_updates’, ‘__return_false’ );  //关闭小版本更新

add_filter( ‘allow_major_auto_core_updates’, ‘__return_false’ );  //关闭大版本更新

add_filter( ‘auto_update_translation’, ‘__return_false’ );  //关闭翻译文件更新

add_filter( ‘automatic_updater_disabled’, ‘__return_true’ );  //关闭所有更新

另外在此推荐一款插件,能够自行设置所有更新功能的开启和关闭。下载update control

3 thoughts on “解决 WordPress 无法自动检查更新

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

滑动到最右以进行验证 *