doutang6819 2015-11-13 20:55
浏览 18
已采纳

WP Catatable致命错误

I'm getting the following error on my site, but only on the live version. The local version is just fine. PHP versions are the same, but is there a particular module in the php.ini file that should be turned on? I'm not sure where to look to fix this problem.

Catchable fatal error: Object of class WP_Error could not be converted to string in /var/www/vhosts/qhxh-vznq.accessdomain.com/httpdocs/wp-content/themes/digiday-careers/content-single-job.php on line 184

Below is where the error is occurring:

 <?php if (!empty($categories)) : ?>
    <div class="job-sidebar-info-block industry">
        <div class="title">Industry</div>
        <?php foreach ($categories as $category) : ?>
            <?php if (class_exists('WP_Job_Manager_Cat_Colors')) : ?>
                <p>
                    <a href="<?php echo get_term_link($category, 'job_listing_category'); ?>" class="job-category <?php echo $category->slug; ?>"><?php echo $category->name; ?>
                    </a>
                </p>
            <?php else : ?>
                <p>
                    <a href="<?php echo get_term_link($category, 'job_listing_category'); ?>">
                        <i class="icon-book-open"></i> 
                        <?php echo $category->name; ?>
                    </a>
                </p>
            <?php endif; ?>
        <?php endforeach; ?>
        </div>
 <?php endif; ?>
  • 写回答

1条回答 默认 最新

  • dsm17496 2015-11-13 21:43
    关注

    Replace the above code you mentioned with this code

    <?php if(!empty($categories)):?>
        <div class="job-sidebar-info-block industry">
            <div class="title">Industry</div>
            <?php foreach ( $categories as $category ) : ?>
                <?php if ( class_exists( 'WP_Job_Manager_Cat_Colors' ) ) : ?>
                    <p><a href="<?php echo is_wp_error( get_term_link( $category, 'job_listing_category' )); ?>" class="job-category <?php echo $category->slug; ?>"><?php echo $category->name; ?></a></p>
                <?php else : ?>
                    <p><a href="<?php echo is_wp_error(get_term_link( $category, 'job_listing_category' )); ?>"><i class="icon-book-open"></i> <?php echo $category->name; ?></a></p>
                <?php endif; ?>
            <?php endforeach; ?>
        </div>
     <?php endif;?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 vue3页面el-table页面数据过多
  • ¥100 vue3中融入gRPC-web
  • ¥15 kali环境运行volatility分析android内存文件,缺profile
  • ¥15 写uniapp时遇到的问题
  • ¥15 vs 2008 安装遇到问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码