解决cos-html-cache 2.7.4中has_cap PHP Notice

升级到WordPress. Version 3.9,启用cos-html-cache时,在提示:
“has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in wp-includes/functions.php on line xxxx”
参考“水景一页”的“关于 WP 中提示 has_cap 的问题”文字,打开cos-html-cache.php 第216行,

add_options_page(‘html-cache-creator’, ‘CosHtmlCache’,8, basename(__FILE__), ‘cosHtmlOption’);
修改为
add_options_page(‘html-cache-creator’, ‘CosHtmlCache’,’manage_options’, basename(__FILE__), ‘cosHtmlOption’);
警告提示消失。

按上文介绍的,是“WordPress 2.0 开始就启用了新的权限标识符号,使用有具体含义的英文字符串,同时保留原来的那一套表示方法。很多插件作者并没有采用新的权限表示方式,因而在开启 WordPress 的调试模式后,用户会看到警告。”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.