简体   繁体   English

Wordpress模板-“可捕获的致命错误:类__PHP_Incomplete_Class的对象无法转换为字符串”

[英]Wordpress Template - “Catchable fatal error: Object of class __PHP_Incomplete_Class could not be converted to string”

I'm using the latest version of Wordpress and while writing a new post, i'm getting a following error in place of the optional boxes, located below the writing area: 我使用的是最新版本的Wordpress,并且在撰写新文章时,出现以下错误,而不是书写区域下方的可选框:

Catchable fatal error: Object of class __PHP_Incomplete_Class could not be converted to string in /home/xxx/public_html/wp-content/themes/xxx/functions/meta-boxes.php on line 466 可捕获的致命错误:__PHP_Incomplete_Class类的对象无法在第466行的/home/xxx/public_html/wp-content/themes/xxx/functions/meta-boxes.php中转换为字符串

I've pasted a the problem code below taken from meta-boxes.php 我粘贴了以下来自meta-boxes.php的问题代码

Also, below, i've commented on the 466th line of code to let you know where the point if error is: 另外,在下面,我对代码的第466行进行了注释,以使您知道错误所在的位置:

 <?php  
    // get review-specific meta fields
    global $oswcPostTypes; 
    $postTypeId = get_post_type( $post->ID );   
    $postType = $oswcPostTypes->get_type_by_id($postTypeId);
    $meta_fields = $postType->meta_fields;
    foreach($meta_fields as $meta){
        //make backwards compatible
        if(is_object($meta)){
            $metaName = $meta->name;
        }else{
            $metaName = $meta;
        }
        $metaNameSafe = str_replace(" ","_",$metaName); // **466th line of error**
        $theMeta = get_post_meta($post->ID, $metaName, $single = true); ?>      
        <p>
        <label for="<?php echo $metaNameSafe; ?>"><?php echo $metaName; ?></label> </td>
        <textarea class="widefat" id="<?php echo $metaNameSafe; ?>" name="<?php echo $metaNameSafe; ?>"><?php echo $theMeta; ?></textarea>
        </p>

    <?php 

I think $meta->name is object. 我认为$ meta-> name是对象。 try : print_r( $meta->name ). 尝试:的print_r($荟萃>名称)。

OR 要么

I think it should be: $metaName = $meta->labels->name 我认为应该是:$ metaName = $ meta-> labels-> name

Not tested though. 虽然没有测试。

Thanks 谢谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 可捕获的致命错误:类__PHP_Incomplete_Class的对象无法转换为字符串 - Catchable Fatal Error: Object of class __PHP_Incomplete_Class could not be converted to string 第70行AbstractToken.php中的ContextErrorException:可捕获的致命错误:__PHP_Incomplete_Class类的对象无法转换为字符串 - ContextErrorException in AbstractToken.php line 70: Catchable Fatal Error: Object of class __PHP_Incomplete_Class could not be converted to string 可捕获的致命错误:__PHP_Incomplete_Class类的对象 - Catchable fatal error: Object of class __PHP_Incomplete_Class __PHP_Incomplete_Class 类的对象无法转换为字符串 - Object of class __PHP_Incomplete_Class could not be converted to string WordPress:可捕获的致命错误:无法将类 stdClass 的对象转换为字符串 - WordPress: Catchable fatal error: Object of class stdClass could not be converted to string Codeigniter - 类__PHP_Incomplete_Class的对象无法转换为字符串 - Codeigniter - Object of class __PHP_Incomplete_Class could not be converted to string PHP可捕获的致命错误:无法将类webhook的对象转换为字符串 - PHP Catchable fatal error: Object of class webhook could not be converted to string PHP Catchable 致命错误:无法将类 stdClass 的对象转换为字符串 - PHP Catchable fatal error: Object of class stdClass could not be converted to string php echo可捕获的致命错误:类的对象……无法转换为 - php echo Catchable fatal error: Object of class … could not be converted to string in PHP-可捕获的致命错误:类的对象无法转换为字符串 - PHP - Catchable fatal error: Object of class could not be converted to string
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM