PHP WordPress错误-可捕获的致命错误:WP_Term类的对象无法转换为字符串

时间:2018-07-13 17:59:00

标签: php arrays wordpress genesis

我正在工作的wordpress网站上有一个子主题,当我尝试登录时会出现错误。主要主题是Genesis。过去一周前一切正常,我无法弄清楚这段代码有什么问题。

错误显示为If word = "and" Or word = "not" Or word = "or" Then cell.Characters(offset, len(word)).Text = UCase(word) End If

是否可以将数组解析为字符串?

这是cstomize-setting.php

中的功能
Catchable fatal error: Object of class WP_Term could not be converted to string in /home/usr234/public_html/wp-content/themes/outreach-pro/lib/cstomize-setting.php on line 408

1 个答案:

答案 0 :(得分:0)

错误是因为$ ms_tags是对象数组而不是名称数组。处理$ ms_tags的代码应作如下更改:

if (is_array($ms_tags)) { 
    foreach ($ms_tags as $ms_taxonomy) {
        add_filter( 'manage_edit-' . $ms_taxonomy->slug . '_columns', 'ms_taxonomy_columns' ); //line no 408
        add_filter( 'manage_' . $ms_taxonomy->slug . '_custom_column', 'ms_taxonomy_column', 10, 3 );
    }
}