I'm working on a client's website that I, nor the company I work for, didn't develop, but due to our contract with the client we now manage the site.
There is an issue with three pages for different project categories that link to different projects within those categories the client has done. The heading on each page is showing "Active Projects" (a separate page and category) instead of the specific project category for each page (Government Development, Healthcare Development and Municipal).
There are multiple other category pages that are working properly, but for some reason these three don't work. I've tried fixing it myself, but I only made things worse. Any help is appreciated.
Here is the code that controls the heading:
<h1><span class="bccTitle2">
<?php
$terms = wp_get_object_terms( $post->ID, 'project_category' );
foreach( $terms as $term )
$term_names[] = $term->name;
//echo implode( ', ', $term_names );
echo $term_names[0];
?>
</span></h1>
get_the_terms()
instead ofwp_get_object_terms()
. developer.wordpress.org/reference/functions/get_the_terms