【问题标题】:ERROR : Object of class WP_Error could not be converted to string错误:类 WP_Error 的对象无法转换为字符串
【发布时间】:2012-07-12 22:14:27
【问题描述】:

可捕获的致命错误:WP_Error 类的对象无法在线转换为 /home/winentra/public_html/s1.ssonline.co.in/wp-content/themes/peekaboo/admin/common-functions.php 中的字符串186

186号线

echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');

请问有什么想法吗?

【问题讨论】:

  • 欢迎来到 Stack Overflow。请注意,您的标题不能很好地代表您所要求的内容。更好的写作会给你带来更好的答案。

标签: php wordpress fatal-error


【解决方案1】:

这个问题的原因和解决方法是here

【讨论】:

    【解决方案2】:

    如果 PHP 无法将其转换为字符串以进行打印,则返回的对象。

    【讨论】:

      【解决方案3】:
      elseif ( is_single() && !is_attachment() && get_post_meta($post->ID, 'cust_cat', true) ) {
            $cat = get_post_meta($post->ID, 'cust_cat', true);
            echo $cat;
            echo $currentBefore;
            the_title();
            echo $currentAfter;
      
          } 
      
          elseif ( is_single() && !is_attachment() && !get_post_meta($post->ID, 'cust_cat', true) ) {
            $cat = get_the_category(); $cat = $cat[0];
            echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
            echo $currentBefore;
            the_title();
            echo $currentAfter;
      
          }
      

      【讨论】:

      • @iCodez 我收到类似于此的错误:“可捕获的致命错误:WP_Error 类的对象无法转换为 /home/preprogrammer20/public_html/wp-includes/formatting.php 中的字符串第 1025 行“我已经尝试了所有方法,但没有任何效果。你能帮我么...?我应该在哪里添加上述代码...?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-03
      • 2014-11-21
      • 2015-02-05
      • 1970-01-01
      相关资源
      最近更新 更多