我一直使用WPAlchemy类在WordPress中创建元盒子,这在我升级到WordPress 3.6之前一直很好。
随着升级,我突然开始得到以下错误:
Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method WPAlchemy_MetaBox::_global_head() should not be called statically in /wp-includes/plugin.php on line 406
Strict Standards: Non-static method WPAlchemy_MetaBox::_is_post() should not be called statically in /wp-content/wpalchemy/MetaBox.php on line 1352
Strict Standards: Non-static method WPAlchemy_MetaBox::_is_post_or_page() should not be called statically in /wp-content/wpalchemy/MetaBox.php on line 986
Strict Standards: Non-static method WPAlchemy_MetaBox::_get_current_post_type() should not be called statically in /wp-content/wpalchemy/MetaBox.php on line 1024
Strict Standards: Non-static method WPAlchemy_MetaBox::_is_page() should not be called statically in /wp-content/wpalchemy/MetaBox.php on line 1352
Strict Standards: Non-static method WPAlchemy_MetaBox::_is_post_or_page() should not be called statically in /wp-content/wpalchemy/MetaBox.php on line 1005
Strict Standards: Non-static method WPAlchemy_MetaBox::_get_current_post_type() should not be called statically in /wp-content/wpalchemy/MetaBox.php on line 1024
无论我是否实际创建了任何元框,都会出现这些错误。
其他一些人似乎也有同样的问题,但我没有找到解决方案(除了禁用错误报告,这并不是真正的解决方案)。不幸的是,这超出了我相当基本的PHP技能。
发布于 2013-10-17 21:03:37
似乎我已经在这个问题上创建了一个解决方案。这里有一些帮助:http://www.pirenko.com/blog/2013/10/17/wpalchemy-warnings-fix/
发布于 2013-12-14 12:57:05
虽然Pirenko链接的补丁正在工作,但这绝对不是解决问题的最佳方法,因为补丁作者只是添加了重复的代码,并避免使用标准的WPAlchemy方法。
此外,那个补丁不知何故导致了我正在处理的插件的问题,所以我不辞辛劳地亲自修复了与WPAlchemy相关的严格通知。以下是更改:https://github.com/mch0lic/wpalchemy/commit/d53216953b1e0f761c6b2f94da257a638f85aa8a
注意,我不确定是否可以将add_action钩子移动到构造器,因为我并不真正熟悉WPAlchemy及其工作流程,但即使在更改WPAlchemy相关代码之后,我的插件也可以正常工作。
https://stackoverflow.com/questions/18316023
复制相似问题