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; ?>
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;?>