Click tracking not working correctly

Hello,

We are using Relevanssi Premium (support help has expired), but the click tracking doesn’t seem to be working correctly and is only tracking 1 post type out of multiple. Our search page is a custom built page and has a WP_Query per post type we want to search as they are separated out on the page but click tracking is only working for our “Person” post type and nothing else, I have attached out search.php

<?php
/**
* The template for displaying search results pages.
*
* @package understrap
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

get_header();

$total_count = 0;

$filter = isset( $_GET['filter-by'] ) ? sanitize_text_field( wp_unslash( $_GET['filter-by'] ) ) : false; // phpcs:ignore
$service_team_query = false;
$sector_query = false;
$news_query = false;
$events_query = false;
$page_query = false;
$people_query = false;

if ( ! $filter || ( $filter && 'service-team' === $filter ) ) {
$args = array(
'post_type' => 'service-team',
'posts_per_page' => 6,
'post_status' => 'publish',
's' => get_search_query(),
'paged' => '1',
);

if ( function_exists( 'relevanssi_do_query' ) ) {
$service_team_query = new WP_Query();
$service_team_query->parse_query( $args );
relevanssi_do_query( $service_team_query );
} else {
$service_team_query = new WP_Query( $args );
}
$total_count = $total_count + $service_team_query->found_posts;
}

if ( ! $filter || ( $filter && 'sector' === $filter ) ) {
$args = array(
'post_type' => 'sector',
'posts_per_page' => 6,
'post_status' => 'publish',
's' => get_search_query(),
'paged' => '1',
);
if ( function_exists( 'relevanssi_do_query' ) ) {
$sector_query = new WP_Query();
$sector_query->parse_query( $args );
relevanssi_do_query( $sector_query );
} else {
$sector_query = new WP_Query( $args );
}
$total_count = $total_count + $sector_query->found_posts;
}

if ( ! $filter || ( $filter && 'post' === $filter ) ) {
$args = array(
'post_type' => 'post',
'posts_per_page' => 6,
'post_status' => 'publish',
's' => get_search_query(),
'paged' => '1',
);
if ( function_exists( 'relevanssi_do_query' ) ) {
$news_query = new WP_Query();
$news_query->parse_query( $args );
relevanssi_do_query( $news_query );
} else {
$news_query = new WP_Query( $args );
}
$total_count = $total_count + $news_query->found_posts;
}

if ( ! $filter || ( $filter && 'tribe_events' === $filter ) ) {
$args = array(
'post_type' => 'tribe_events',
'posts_per_page' => 6,
'post_status' => 'publish',
's' => get_search_query(),
'paged' => '1',
'orderby' => '_EventStartDate',
'order' => 'ASC',
'meta_query' => array( // phpcs:ignore
'relation' => 'OR',
array(
'key' => '_EventStartDate',
'value' => gmdate( 'Y-m-d H:i:s' ),
'compare' => '>=',
'type' => 'DATETIME',
),
array(
'key' => '_EventEndDate',
'value' => gmdate( 'Y-m-d H:i:s' ),
'compare' => '>=',
'type' => 'DATETIME',
),
),
);

if ( function_exists( 'relevanssi_do_query' ) ) {
$events_query = new WP_Query();
$events_query->parse_query( $args );
relevanssi_do_query( $events_query );
} else {
$events_query = new WP_Query( $args );
}
$total_count = $total_count + $events_query->found_posts;
}

if ( ! $filter || ( $filter && 'page' === $filter ) ) {
$args = array(
'post_type' => 'page',
'posts_per_page' => 6,
'post_status' => 'publish',
's' => get_search_query(),
'paged' => '1',
);

if ( function_exists( 'relevanssi_do_query' ) ) {
$page_query = new WP_Query();
$page_query->parse_query( $args );
relevanssi_do_query( $page_query );
} else {
$page_query = new WP_Query( $args );
}
$total_count = $total_count + $page_query->found_posts;
}

if ( ! $filter || ( $filter && 'person' === $filter ) ) {
$args = array(
'post_type' => 'person',
'posts_per_page' => 8,
'post_status' => 'publish',
's' => get_search_query(),
'paged' => '1',
);

if ( function_exists( 'relevanssi_do_query' ) ) {
$people_query = new WP_Query();
$people_query->parse_query( $args );
relevanssi_do_query( $people_query );
} else {
$people_query = new WP_Query( $args );
}
$total_count = $total_count + $people_query->found_posts;
}

?>

<div class="block-wrapper site-search" id="search-wrapper">

<section class="block block--spc block--primary hero hero--simple">
<div class="container">
<?php if ( function_exists( 'yoast_breadcrumb' ) ) : ?>
<div class="breadcrumb">
<ul class="list-unstyled d-flex flex-wrap mb-0">
<?php yoast_breadcrumb( '<li>', '</li>' ); ?>
</ul>
</div>
<?php endif; ?>

<div class="row">
<div class="col-md-10 col-lg-6">
<h1 class="mb-0">Search Results</h1>
</div>
</div>
</div>
</section>

<section class="block block--mtm site-search-form">
<div class="container">
<?php require locate_template( 'searchform.php' ); ?>
</div>
</section>

<section class="block block--spc block--white site-search-results">
<?php // if there are results:. ?>
<div class="container">
<?php // Update search query. ?>
<?php if ( isset( $_GET['s'] ) && $total_count ) : ?>
<p>Your search for "<?php echo esc_html( sanitize_text_field( wp_unslash( $_GET['s'] ) ) ); ?>" returned <?php echo esc_html( $total_count ); ?> search results.</p>
<?php endif; ?>

<?php // services results:. ?>
<?php if ( $service_team_query && $service_team_query->have_posts() ) : ?>
<div class="row">
<div class="col-12 d-flex flex-wrap justify-content-between site-search-results__title">
<h2 class="visual-h4 mb-0">Services</h2>
<p class="mb-0">Showing 1-<span class="total-shown"><?php echo 1 !== (int) $service_team_query->max_num_pages ? esc_html( $service_team_query->get( 'paged' ) * $service_team_query->get( 'posts_per_page' ) ) : esc_html( $service_team_query->found_posts ); ?></span> of <?php echo esc_html( $service_team_query->found_posts ); ?></p>
</div>

<?php // the list items:. ?>
<div class="col-12">
<ul class="list-unstyled p-0 mb-0 list-grid-list">
<?php
while ( $service_team_query->have_posts() ) :
$service_team_query->the_post();
?>
<li>
<a href="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_the_permalink() ); ?>" class="d-flex justify-content-between btn-link btn-link--arrow list-grid-list__btn">
<span><?php echo esc_html( get_the_title() ); ?></span>
<span class="ico icon-arrow-reg-right" aria-hidden="true"></span>
</a>
</li>
<?php endwhile; ?>
<li class="d-none load-more-point"></li>
</ul>
</div>

<?php if ( 1 < $service_team_query->max_num_pages ) : ?>
<div class="col-12">
<button class="d-block text-center w-100 btn-link search-results__more" data-post-type="<?php echo esc_attr( $service_team_query->get( 'post_type' ) ); ?>" data-page="2" data-query="<?php echo esc_attr( get_search_query() ); ?>" data-ppp="<?php echo esc_attr( $service_team_query->get( 'posts_per_page' ) ); ?>">
<span>Load more</span>
</button>
</div>
<?php endif; ?>
</div>
<?php wp_reset_postdata(); ?>
<?php endif; ?>

<?php // sectors results:. ?>
<?php if ( $sector_query && $sector_query->have_posts() ) : ?>
<div class="row">
<div class="col-12 d-flex flex-wrap justify-content-between site-search-results__title">
<h2 class="visual-h4 mb-0">Sectors</h2>
<p class="mb-0">Showing 1-<span class="total-shown"><?php echo 1 !== (int) $sector_query->max_num_pages ? esc_html( $sector_query->get( 'paged' ) * $sector_query->get( 'posts_per_page' ) ) : esc_html( $sector_query->found_posts ); ?></span> of <?php echo esc_html( $sector_query->found_posts ); ?></p>
</div>

<?php // the list items:. ?>
<div class="col-12">
<ul class="list-unstyled p-0 mb-0 list-grid-list">
<?php
while ( $sector_query->have_posts() ) :
$sector_query->the_post();
?>
<li>
<a href="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_the_permalink() ); ?>" class="d-flex justify-content-between btn-link btn-link--arrow list-grid-list__btn">
<span><?php echo esc_html( get_the_title() ); ?></span>
<span class="ico icon-arrow-reg-right" aria-hidden="true"></span>
</a>
</li>
<?php endwhile; ?>
<li class="d-none load-more-point"></li>
</ul>
</div>

<?php if ( 1 < $sector_query->max_num_pages ) : ?>
<div class="col-12">
<button class="d-block text-center w-100 btn-link search-results__more" data-post-type="<?php echo esc_attr( $sector_query->get( 'post_type' ) ); ?>" data-page="2" data-query="<?php echo esc_attr( get_search_query() ); ?>" data-ppp="<?php echo esc_attr( $sector_query->get( 'posts_per_page' ) ); ?>">
<span>Load more</span>
</button>
</div>
<?php endif; ?>
</div>
<?php wp_reset_postdata(); ?>
<?php endif; ?>

<?php // news & insights results:. ?>
<?php if ( $news_query && $news_query->have_posts() ) : ?>
<div class="row">
<div class="col-12 d-flex flex-wrap justify-content-between site-search-results__title">
<h2 class="visual-h4 mb-0">News and Insights</h2>
<p class="mb-0">Showing 1-<span class="total-shown"><?php echo 1 !== (int) $news_query->max_num_pages ? esc_html( $news_query->get( 'paged' ) * $news_query->get( 'posts_per_page' ) ) : esc_html( $news_query->found_posts ); ?></span> of <?php echo esc_html( $news_query->found_posts ); ?></p>
</div>

<?php // the cards:. ?>
<?php
while ( $news_query->have_posts() ) :
$news_query->the_post();
?>
<div class="col-sm-6 col-lg-4">
<article class="card card--news">
<div class="ratio ratio-16x9 card-ratio">
<?php if ( get_post_thumbnail_id( get_the_ID() ) ) : ?>
<?php
$attachment_id = get_post_thumbnail_id( get_the_ID() );
$thumbnail_url = isset( wp_get_attachment_image_src( $attachment_id, 'card-image' )[0] ) ? wp_get_attachment_image_src( $attachment_id, 'card-image' )[0] : '';
$alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
?>
<img class="card__image" src="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( $thumbnail_url ); ?>" alt="<?php echo esc_attr( $alt ); ?>" loading="lazy">
<?php else : ?>
<img class="card-img-top" src="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_stylesheet_directory_uri() ); ?>/assets/images/post-placeholder.webp" alt="" loading="lazy">
<?php endif; ?>
</div>

<div class="card-body">
<?php if ( get_the_terms( get_the_ID(), 'news-type' ) ) : ?>
<?php $singular = get_field( 'singular_name', 'news-type_' . get_the_terms( get_the_ID(), 'news-type' )[0]->term_id ); ?>
<div class="card-cat-wrapper">
<span class="card-cat"><strong><?php echo $singular ? esc_html( $singular ) : esc_html( get_the_terms( get_the_ID(), 'news-type' )[0]->name ); ?></strong></span>
</div>
<?php endif; ?>

<div class="d-flex justify-content-between flex-wrap card-info">
<span><?php echo esc_html( get_the_date( 'j F Y', get_the_ID() ) ); ?></span>
<?php if ( $read_time ) : ?>
<span><?php echo esc_html( $read_time ); ?></span>
<?php endif; ?>
</div>

<h2 class="card-title visual-h4">
<a href="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_the_permalink( get_the_ID() ) ); ?>" class="card-link stretched-link">
<?php echo esc_html( get_the_title( get_the_ID() ) ); ?>
</a>
</h2>

<span class="btn-link btn-link--arrow">
<span>Read more</span>
<span class="ico icon-arrow-reg-right" aria-hidden="true"></span>
</span>
</div>
</article>
</div>
<?php endwhile; ?>

<div class="d-none load-more-point"></div>

<?php if ( 1 < $news_query->max_num_pages ) : ?>
<div class="col-12">
<button class="d-block text-center w-100 btn-link search-results__more" data-post-type="<?php echo esc_attr( $news_query->get( 'post_type' ) ); ?>" data-page="2" data-query="<?php echo esc_attr( get_search_query() ); ?>" data-ppp="<?php echo esc_attr( $news_query->get( 'posts_per_page' ) ); ?>">
<span>Load more</span>
</button>
</div>
<?php endif; ?>
</div>
<?php wp_reset_postdata(); ?>
<?php endif; ?>

<?php // events results:. ?>
<?php if ( $events_query && $events_query->have_posts() ) : ?>
<div class="row">
<div class="col-12 d-flex flex-wrap justify-content-between site-search-results__title">
<h2 class="visual-h4 mb-0">Events</h2>
<p class="mb-0">Showing 1-<span class="total-shown"><?php echo 1 !== (int) $events_query->max_num_pages ? esc_html( $events_query->get( 'paged' ) * $events_query->get( 'posts_per_page' ) ) : esc_html( $events_query->found_posts ); ?></span> of <?php echo esc_html( $events_query->found_posts ); ?></p>
</div>

<?php
while ( $events_query->have_posts() ) :
$events_query->the_post();
?>
<div class="col-sm-6 col-lg-4">
<article class="card">
<div class="ratio ratio-16x9 card-ratio">
<?php if ( get_post_thumbnail_id( get_the_ID() ) ) : ?>
<?php
$attachment_id = get_post_thumbnail_id( get_the_ID() );
$thumbnail_url = isset( wp_get_attachment_image_src( $attachment_id, 'card-image' )[0] ) ? wp_get_attachment_image_src( $attachment_id, 'card-image' )[0] : '';
$alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
?>
<img class="card__image" src="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( $thumbnail_url ); ?>" alt="<?php echo esc_attr( $alt ); ?>" loading="lazy">
<?php else : ?>
<img class="card-img-top" src="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_stylesheet_directory_uri() ); ?>/assets/images/post-placeholder.webp" alt="" loading="lazy">
<?php endif; ?>
</div>

<div class="card-body">
<?php if ( get_the_terms( get_the_ID(), 'tribe_events_cat' ) ) : ?>
<div class="card-cat-wrapper">
<a href="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_post_type_archive_link("tribe_events' ) . '?category=' . get_the_terms( get_the_ID(), 'tribe_events_cat' )[0]->term_id ); ?>" class="card-cat"><strong><?php echo esc_html( get_the_terms( get_the_ID(), 'tribe_events_cat' )[0]->name ); ?></strong></a>
</div>
<?php endif; ?>

<?php if ( tribe_get_start_date( get_the_ID() ) ) : ?>
<div class="d-flex justify-content-between flex-wrap card-info">
<?php $sdate_format = ( tribe_get_start_date( get_the_ID(), false, 'F Y' ) === tribe_get_end_date( get_the_ID(), false, 'F Y' ) && tribe_get_end_date( get_the_ID(), false, 'j F Y' ) !== tribe_get_start_date( get_the_ID(), false, 'j F Y' ) ) ? 'j' : 'j F Y'; ?>
<span>
<?php echo esc_html( tribe_get_start_date( get_the_ID(), false, $sdate_format ) ); ?>
<?php if ( tribe_get_end_date( get_the_ID(), false, 'j F Y' ) !== tribe_get_start_date( get_the_ID(), false, 'j F Y' ) ) : ?>
- <?php echo esc_html( tribe_get_end_date( get_the_ID(), false, 'j F Y' ) ); ?>
<?php endif; ?>
</span>
<span>
<?php echo esc_html( tribe_get_start_date( get_the_ID(), false, 'H:i' ) ); ?>
<?php if ( tribe_get_end_date( get_the_ID(), false, 'H:i' ) !== tribe_get_start_date( get_the_ID(), false, 'H:i' ) ) : ?>
- <?php echo esc_html( tribe_get_end_date( get_the_ID(), false, 'H:i' ) ); ?>
<?php endif; ?>
</span>
</div>
<?php endif; ?>

<h2 class="card-title visual-h4">
<a href="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_the_permalink( get_the_ID() ) ); ?>" class="card-link stretched-link">
<?php echo esc_html( get_the_title( get_the_ID() ) ); ?>
</a>
</h2>

<?php if ( tribe_get_venue( get_the_ID() ) ) : ?>
<p class="card-location">
<span class="ico icon-location" aria-hidden="true"></span>
<span><?php echo esc_html( tribe_get_venue( get_the_ID() ) ); ?><?php echo tribe_get_city( get_the_ID() ) ? ', ' . esc_html( tribe_get_city( get_the_ID() ) ) : ''; ?></span>
</p>
<?php endif; ?>

<?php if ( get_the_excerpt( get_the_ID() ) ) : ?>
<p class="card-text"><?php echo esc_html( get_the_excerpt( get_the_ID() ) ); ?></p>
<?php endif; ?>

<span class="btn-link btn-link--arrow">
<span>View event</span>
<span class="ico icon-arrow-reg-right" aria-hidden="true"></span>
</span>
</div>
</article>
</div>
<?php endwhile; ?>

<div class="d-none load-more-point"></div>

<?php if ( 1 < $events_query->max_num_pages ) : ?>
<div class="col-12">
<button class="d-block text-center w-100 btn-link search-results__more" data-post-type="<?php echo esc_attr( $events_query->get( 'post_type' ) ); ?>" data-page="2" data-query="<?php echo esc_attr( get_search_query() ); ?>" data-ppp="<?php echo esc_attr( $events_query->get( 'posts_per_page' ) ); ?>">
<span>Load more</span>
</button>
</div>
<?php endif; ?>
</div>
<?php wp_reset_postdata(); ?>
<?php endif; ?>

<?php // pages results:. ?>
<?php if ( $page_query && $page_query->have_posts() ) : ?>
<div class="row">
<div class="col-12 d-flex flex-wrap justify-content-between site-search-results__title">
<h2 class="visual-h4 mb-0">Pages</h2>
<p class="mb-0">Showing 1-<span class="total-shown"><?php echo 1 !== (int) $page_query->max_num_pages ? esc_html( $page_query->get( 'paged' ) * $page_query->get( 'posts_per_page' ) ) : esc_html( $page_query->found_posts ); ?></span> of <?php echo esc_html( $page_query->found_posts ); ?></p>
</div>

<?php // the page cards:. ?>
<?php
while ( $page_query->have_posts() ) :
$page_query->the_post();
?>
<div class="col-sm-6 col-lg-4">
<article class="card card--page">
<h3 class="card-title visual-h4">
<a href="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_the_permalink() ); ?>" class="card-link stretched-link"><?php echo esc_html( get_the_title() ); ?></a>
</h3>

<p><?php echo wp_kses_post( get_the_excerpt() ); ?></p>

<span class="btn-link btn-link--arrow p-0">
<span>Read more</span>
<span class="ico icon-arrow-reg-right" aria-hidden="true"></span>
</span>
</article>
</div>
<?php endwhile; ?>

<div class="d-none load-more-point"></div>

<?php if ( 1 < $page_query->max_num_pages ) : ?>
<div class="col-12">
<button class="d-block text-center w-100 btn-link search-results__more" data-post-type="<?php echo esc_attr( $page_query->get( 'post_type' ) ); ?>" data-page="2" data-query="<?php echo esc_attr( get_search_query() ); ?>" data-ppp="<?php echo esc_attr( $page_query->get( 'posts_per_page' ) ); ?>">
<span>Load more</span>
</button>
</div>
<?php endif; ?>
</div>
<?php wp_reset_postdata(); ?>
<?php endif; ?>

<?php // people results:. ?>
<?php if ( $people_query && $people_query->have_posts() ) : ?>
<div class="row">
<div class="col-12 d-flex flex-wrap justify-content-between site-search-results__title">
<h2 class="visual-h4 mb-0">People</h2>
<p class="mb-0">Showing 1-<span class="total-shown"><?php echo 1 !== (int) $people_query->max_num_pages ? esc_html( $people_query->get( 'paged' ) * $people_query->get( 'posts_per_page' ) ) : esc_html( $people_query->found_posts ); ?></span> of <?php echo esc_html( $people_query->found_posts ); ?></p>
</div>

<?php
while ( $people_query->have_posts() ) :
$people_query->the_post();
?>
<div class="col-sm-6 col-lg-4 col-xl-3">
<article class="card card-person">
<div class="ratio ratio-16x9 card-ratio">
<?php if ( get_post_thumbnail_id( get_the_ID() ) ) : ?>
<?php
$attachment_id = get_post_thumbnail_id( get_the_ID() );
$thumbnail_url = isset( wp_get_attachment_image_src( $attachment_id, 'card-image' )[0] ) ? wp_get_attachment_image_src( $attachment_id, 'card-image' )[0] : '';
$alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
?>
<img class="card__image" src="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( $thumbnail_url ); ?>" alt="<?php echo esc_attr( $alt ); ?>" loading="lazy">
<?php elseif ( get_field( 'images', get_the_ID() ) && is_array( get_field( 'images', get_the_ID() ) ) && isset( get_field( 'images', get_the_ID() )[0] ) && isset( get_field( 'images', get_the_ID() )[0]['sizes']['card-image'] ) ) : ?>
<img class="card__image" src="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_field("images', get_the_ID() )[0]['sizes']['card-image'] ); ?>" alt="<?php echo esc_attr( get_field( 'images', get_the_ID() )[0]['alt'] ); ?>" loading="lazy">
<?php else : ?>
<img class="card-img-top" src="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_stylesheet_directory_uri() ); ?>/assets/images/post-placeholder.webp" alt="" loading="lazy">
<?php endif; ?>
</div>

<div class="card-body">
<h2 class="card-title visual-h4">
<a href="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_the_permalink() ); ?>" class="card-link stretched-link"><?php echo esc_html( get_the_title() ); ?></a>
</h2>

<div class="card-info">
<?php
$job_title = $fncs->get_job_title( get_the_ID() );
if ( $job_title ) :
?>
<span><?php echo esc_html( $job_title ); ?></span>
<?php endif; ?>
</div>

<?php $phone_number = $fncs->get_phone_number( get_the_ID() ); ?>
<?php if ( $phone_number && isset( $phone_number['main'] ) ) : ?>
<p class="card-text">
<a href="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/tel:<?php echo esc_attr( str_replace(" ', '', $phone_number['main'] ) ); ?>" class="phone"><?php echo esc_html( $phone_number['main'] ); ?></a>
</p>
<?php endif; ?>
<?php if ( $phone_number && isset( $phone_number['mobile'] ) ) : ?>
<p class="card-text<?php echo ( isset( $phone_number['main'] ) ) ? ' mt-0' : ''; ?>">
<a href="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/tel:<?php echo esc_attr( str_replace(" ', '', $phone_number['mobile'] ) ); ?>" class="phone"><?php echo esc_html( $phone_number['mobile'] ); ?></a>
</p>
<?php endif; ?>

<span class="btn-link btn-link--arrow">
<span>View profile</span>
<span class="ico icon-arrow-reg-right" aria-hidden="true"></span>
</span>
</div>
<?php if ( isset( $_GET['display'] ) && 'office' === $_GET['display'] && get_field( 'office', get_the_ID() ) && 'publish' === get_post_status( get_field( 'office', get_the_ID() )[0]->ID ) ) : ?>
<div class="card-footer">
<a href="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_post_type_archive_link("person' ) . '?offices=" . get_field( "office', get_the_ID() )[0]->ID ); ?>">
<strong><?php echo esc_html( get_field( 'office', get_the_ID() )[0]->post_title ); ?></strong>
</a>
</div>
<?php elseif ( get_field( 'service_team', get_the_ID() ) && isset( get_field( 'service_team', get_the_ID() )[0] ) && 'publish' === get_post_status( get_field( 'service_team', get_the_ID() )[0]->ID ) ) : ?>
<div class="card-footer">
<a href="https://projectdmc.org/support/topic/click-tracking-not-working-correctly/<?php echo esc_url( get_the_permalink( get_field("service_team', get_the_ID() )[0] ) ); ?>">
<strong><?php echo esc_html( get_the_title( get_field( 'service_team', get_the_ID() )[0] ) ); ?></strong>
</a>
</div>
<?php endif; ?>
</article>
</div>
<?php endwhile; ?>

<div class="d-none load-more-point"></div>

<?php if ( 1 < $people_query->max_num_pages ) : ?>
<div class="col-12">
<button class="d-block text-center w-100 btn-link search-results__more" data-post-type="<?php echo esc_attr( $people_query->get( 'post_type' ) ); ?>" data-page="2" data-query="<?php echo esc_attr( get_search_query() ); ?>" data-ppp="<?php echo esc_attr( $people_query->get( 'posts_per_page' ) ); ?>">
<span>Load more</span>
</button>
</div>
<?php endif; ?>
</div>
</div>
<?php wp_reset_postdata(); ?>
<?php endif; ?>

<?php // if there are no results:. ?>

<?php if ( ! $total_count ) : ?>
<div class="container">
<div class="row">
<p class="mb-0 p-0">We're sorry, but it seems there are no results matching your search criteria at the moment.</p>
</div>
</div>
<?php endif; ?>
</section>

</div><!-- #search-wrapper -->

<?php get_footer(); ?>

As you can see from the image below the tracking code correctly gets added to the permalink for a person card

But doesn’t get added for any of the other post types

Also below i have attached our Relevanssi settings if that helps in anyway (API Key redacted)

{"relevanssi_admin_search":"off","relevanssi_api_key":"XXXXXXXX","relevanssi_bg_col":"#ffaf75","relevanssi_body_stopwords":[false],"relevanssi_cat":"","relevanssi_class":"relevanssi-query-term","relevanssi_comment_boost":"1","relevanssi_content_boost":"2.5","relevanssi_css":"text-decoration: underline; text-color: #ff0000","relevanssi_db_version":"23","relevanssi_default_orderby":"relevance","relevanssi_disable_or_fallback":"off","relevanssi_disable_shortcodes":"","relevanssi_do_not_call_home":"off","relevanssi_exact_match_bonus":"on","relevanssi_excat":"","relevanssi_excerpt_allowable_tags":"","relevanssi_excerpt_custom_fields":"off","relevanssi_excerpt_length":"30","relevanssi_excerpt_specific_fields":"off","relevanssi_excerpt_type":"words","relevanssi_excerpts":"on","relevanssi_exclude_posts":"","relevanssi_expand_highlights":"off","relevanssi_expand_shortcodes":"off","relevanssi_extag":"0","relevanssi_fuzzy":"sometimes","relevanssi_hide_branding":"off","relevanssi_hide_post_controls":"off","relevanssi_highlight":"no","relevanssi_highlight_comments":"off","relevanssi_highlight_docs":"off","relevanssi_hilite_title":"off","relevanssi_implicit_operator":"AND","relevanssi_index_author":"off","relevanssi_index_comments":"none","relevanssi_index_excerpt":"off","relevanssi_index_fields":"visible","relevanssi_index_image_files":"on","relevanssi_index_limit":false,"relevanssi_index_pdf_parent":"off","relevanssi_index_post_type_archives":"off","relevanssi_index_post_types":["post","page","tribe_events","person","service-team","sector","office","case-study","testimonial","news","blog","insight","bogus"],"relevanssi_index_subscribers":"off","relevanssi_index_synonyms":"off","relevanssi_index_taxonomies":"off","relevanssi_index_taxonomies_list":[],"relevanssi_index_terms":[],"relevanssi_index_user_fields":"","relevanssi_index_users":"off","relevanssi_internal_links":"noindex","relevanssi_link_boost":"0.75","relevanssi_link_pdf_files":"off","relevanssi_log_queries":"on","relevanssi_log_queries_with_ip":"on","relevanssi_max_excerpts":"1","relevanssi_min_word_length":"3","relevanssi_mysql_columns":"","relevanssi_omit_from_logs":"","relevanssi_polylang_all_languages":"off","relevanssi_post_type_ids":false,"relevanssi_post_type_weights":{"post_tag":1,"category":1},"relevanssi_punctuation":{"quotes":"replace","hyphens":"replace","ampersands":"replace","decimals":"remove"},"relevanssi_read_new_files":"off","relevanssi_recency_bonus":{"bonus":"","days":""},"relevanssi_redirects":[],"relevanssi_related_settings":{"enabled":"off","number":6,"nothing":"nothing","notenough":"random","post_types":"post","keyword":"title","append":"","cache_for_admins":"off","months":0,"restrict":""},"relevanssi_related_style":{"width":250,"titles":"on","excerpts":"off","thumbnails":"on","default_thumbnail":""},"relevanssi_respect_exclude":"on","relevanssi_searchblogs":false,"relevanssi_searchblogs_all":"","relevanssi_send_pdf_files":"off","relevanssi_seo_noindex":"on","relevanssi_server_location":"eu","relevanssi_show_matches":"off","relevanssi_show_matches_text":"(Search hits: %body% in body, %title% in title, %categories% in categories, %tags% in tags, %taxonomies% in other taxonomies, %comments% in comments. Score: %score%)","relevanssi_show_post_controls":"off","relevanssi_spamblock":{"keywords":"satanic\r\n.com\r\n.top\r\n.ru\r\nhoducomics\r\n\uc6cc\r\n.in\r\n.org\r\nbible\r\n.net\r\n.site\r\nhttp\r\nviagra\r\n$ts\r\n\uc6b8\r\n.de\r\n.id\r\n.ph\r\n\uc740\r\n\uad6c\r\n\ubbf8\r\n\ud504\r\n\uc9c4\r\n\uc5b4\r\n\ub514\r\n\uc11c\r\n\uad6c\r\n\uc785\r\n\ub300\r\n\ud55c\r\n\ubaa8\r\n\ub4e0\r\n\uc815\r\n\ubcf4\r\n\uac00\r\n\ub099\r\n\ud0dc\r\n\uc218\r\n\uc220\r\n\uac00\r\n\ub2a5\r\n\ud55c\r\n\uacf3\r\n\ubbf8\r\n\ud504\r\n\uc9c4\r\n\ub099\r\n\ud0dc\r\n\uc57d\r\n\uad6c\r\n\uc785\r\n\uacf5\r\n\uc2dd\r\n\ud648\r\n\ud398\r\n\uc774\r\n\uc9c0\r\n.fr\r\n\ud64d\r\n\ucf69\r\n\uc1fc\r\n\ud551\r\n\uba74\r\n\uc138\r\n.work\r\n\ud638\r\n\ub450\r\n\ucf54\r\n\ubbf9\r\n\uc2a4\r\n\uc0b0\u00ad\r\n\uc545\r\n\u00ad\ud68c\r\n\ub3d9\r\n\ud638\r\n\ud68c\r\n\ubaa9\r\n\ud3ec\r\n\ubaa9\r\n\ud3ec\r\n\ubaa9\r\n\ud3ec\r\n\ubaa9\r\n\ud3ec\r\n\uc624\r\n\ud53c\r\n\uc870\r\n\uc120\r\n\ub2ec\r\n\ub9ac\r\n\uae30\r\n\uc8fc\r\n\uc18c\r\n\uc77c\r\n\u00ad\uc0b0\r\n\uc18c\r\n\uac1c\r\n\ud305\r\n\uc7a5\r\n\uc18c\r\n.pw\r\n.bid\r\n.art\r\n\uc628\r\n\ub77c\r\n\uc778 \r\n\uacbd\r\n\ub9c8\r\n\uac8c\r\n\uc784\r\n\uc3d8\r\n\uac78\r\n\ud038\u00ad\r\n\uce74\r\n\ud074\r\n\ub7fd\r\n\ubc24\r\n\uc758\r\n\uc804\r\n\uc7c1\r\n\uac74\r\n\uc804\r\n\ub9cc\r\n\ub0a8\r\n\ube44\r\n\ubc45\r\n\ucee4\r\n\ub73b\r\n.kr\r\n\ub9e4\r\n\ubc0d\r\n\ud0a4\r\n\ub137\r\n\ub4dc\r\n\ub798\r\n\uace4\r\n\ub304\r\nsatanic\r\n.com\r\n.top\r\n.ru\r\nhoducomics\r\n\uc6cc\r\n.in\r\n.org\r\nbible\r\n.net\r\n.site\r\nhttp\r\nviagra\r\n$ts\r\n\uc6b8\r\n.de\r\n.id\r\n.ph\r\n\uc740\r\n\uad6c\r\n\ubbf8\r\n\ud504\r\n\uc9c4\r\n\uc5b4\r\n\ub514\r\n\uc11c\r\n\uad6c\r\n\uc785\r\n\ub300\r\n\ud55c\r\n\ubaa8\r\n\ub4e0\r\n\uc815\r\n\ubcf4\r\n\uac00\r\n\ub099\r\n\ud0dc\r\n\uc218\r\n\uc220\r\n\uac00\r\n\ub2a5\r\n\ud55c\r\n\uacf3\r\n\ubbf8\r\n\ud504\r\n\uc9c4\r\n\ub099\r\n\ud0dc\r\n\uc57d\r\n\uad6c\r\n\uc785\r\n\uacf5\r\n\uc2dd\r\n\ud648\r\n\ud398\r\n\uc774\r\n\uc9c0\r\n.fr\r\n\ud64d\r\n\ucf69\r\n\uc1fc\r\n\ud551\r\n\uba74\r\n\uc138\r\n.work\r\n\ud638\r\n\ub450\r\n\ucf54\r\n\ubbf9\r\n\uc2a4\r\n\uc0b0\u00ad\r\n\uc545\r\n\u00ad\ud68c\r\n\ub3d9\r\n\ud638\r\n\ud68c\r\n\ubaa9\r\n\ud3ec\r\n\ubaa9\r\n\ud3ec\r\n\ubaa9\r\n\ud3ec\r\n\ubaa9\r\n\ud3ec\r\n\uc624\r\n\ud53c\r\n\uc870\r\n\uc120\r\n\ub2ec\r\n\ub9ac\r\n\uae30\r\n\uc8fc\r\n\uc18c\r\n\uc77c\r\n\u00ad\uc0b0\r\n\uc18c\r\n\uac1c\r\n\ud305\r\n\uc7a5\r\n\uc18c\r\n.pw\r\n.bid\r\n.art\r\n\uc628\r\n\ub77c\r\n\uc778 \r\n\uacbd\r\n\ub9c8\r\n\uac8c\r\n\uc784\r\n\uc3d8\r\n\uac78\r\n\ud038\u00ad\r\n\uce74\r\n\ud074\r\n\ub7fd\r\n\ubc24\r\n\uc758\r\n\uc804\r\n\uc7c1\r\n\uac74\r\n\uc804\r\n\ub9cc\r\n\ub0a8\r\n\ube44\r\n\ubc45\r\n\ucee4\r\n\ub73b\r\n.kr\r\n\ub9e4\r\n\ubc0d\r\n\ud0a4\r\n\ub137\r\n\ub4dc\r\n\ub798\r\n\uace4\r\n\ub304\r\n\uc0dd\r\n\ud65c\r\n\uc5d0\r\nvimax\r\nkamagra\r\n\uc131\r\nm.haku\r\nm.w444\r\n.club\r\n\u008c\r\n\ubd80\uc0b0+\r\nwangjinduo\r\n\uc544\r\nl0leh5\r\n.fun\r\nm.haku.ltd\r\n.ienglish\r\n.cool\r\nzcapay.club\r\n\uc2dc\r\n%\r\nhllsjkhj\r\n.cyou\r\njinkan\r\n.xyz\r\ne22\r\n.fun\r\n\u00f0\r\n\uc130\r\n%\r\nm.\r\nzhuanwupinggw\r\n.online\r\npsgame\r\nnews.\r\n.wiki\r\n\ubb34\r\n\ub8cc\r\n%e\r\n\u06ba\u201d\u00a5\u00e2\u0153\u0686\u00e2\u203a\u00b0\r\nslotmania\r\n.shop\r\n.ltd\r\nbatmanapollo\r\n+++++++\r\n.bzh\r\ntesla\r\n+booking\r\n\ub86f\r\n\uba38\r\nCialis\r\n.euq\r\nbuy+counterfeit+pounds+\r\nBbin\r\nSt1313\r\n\u2548\r\n\uc720\r\n\uce0c\r\n\ud53d\r\n\ud154\r\n\ub808\r\nGmt11\r\n\uc720\r\n\ucd9c\r\n\ud53d\r\n\ud569\r\n\ub2c8\r\n\ub2e4\r\n\uc720\r\n\ucd9c\r\n\ud53d\r\n\ud31d\r\n\ub2c8\r\n\ub2e4\r\n\uc720\r\n\ucd9c\r\n\ud53d\r\n\ud569\r\n\ub2c8\r\n\ub2e4\r\n\u00bf\r\n\uc720\r\n\ucd9c\r\n\ud53d\r\n\uc720\r\n\ucd9c\r\n\ud53d\r\n\ud569\r\n\ub2c8\r\n\ub2e4\r\n\uc720\r\n\ucd9c\r\n\ud53d\r\n\uc720\r\n\ucd9c\r\n\ud53d\r\n\ud31d\r\n\ub2c8\r\n\ub2e4\r\n\u2537\r\n\ud520\r\nYadongtube\r\n\ud654\r\n\u00ad\uc0c1\r\n\u00ad\uba54\r\n\u00ad\uc2e0\r\n\u00ad\uc800\r\n\ubcf5\r\n\uc6a9\r\n\ud6c4\r\n\ub098\r\n\ud0c0\r\n\ub098\r\n\ub294\r\n\uc99d","regex":"","chinese":"on","cyrillic":"on","emoji":"on","bots":"on"},"relevanssi_stopwords":{"en_GB":"a,about,above,across,after,afterwards,again,against,all,almost,alone,along,already,also,although,always,am,among,amongst,amoungst,amount,an,and,another,any,anyhow,anyone,anything,anyway,anywhere,are,around,as,at,back,be,became,because,become,becomes,becoming,been,before,beforehand,behind,being,below,beside,besides,between,beyond,bill,both,bottom,but,by,call,can,cannot,cant,co,con,could,couldnt,cry,de,describe,detail,do,done,down,due,during,each,eg,eight,either,eleven,else,elsewhere,empty,enough,etc,even,ever,every,everyone,everything,everywhere,except,few,fifteen,fifty,fill,find,fire,first,five,for,former,formerly,forty,found,four,from,front,full,further,get,give,go,had,has,hasnt,have,he,hence,her,here,hereafter,hereby,herein,hereupon,hers,herself,him,himself,his,how,however,hundred,ie,if,in,inc,indeed,interest,into,is,it,its,itself,keep,last,latter,latterly,least,less,ltd,made,many,may,me,meanwhile,might,mill,mine,more,moreover,most,mostly,move,much,must,my,myself,name,namely,neither,never,nevertheless,next,nine,no,nobody,none,noone,nor,not,nothing,now,nowhere,of,off,often,on,once,one,only,onto,or,other,others,otherwise,our,ours,ourselves,out,over,own,part,per,perhaps,please,put,rather,re,same,see,seem,seemed,seeming,seems,serious,several,she,should,show,side,since,sincere,six,sixty,so,some,somehow,someone,something,sometime,sometimes,somewhere,still,such,system,take,ten,than,that,the,their,them,themselves,then,thence,there,thereafter,thereby,therefore,therein,thereupon,these,they,thickv,thin,third,this,those,though,three,through,throughout,thru,thus,to,together,too,top,toward,towards,twelve,twenty,two,un,under,until,up,upon,us,very,via,was,we,well,were,what,whatever,when,whence,whenever,where,whereafter,whereas,whereby,wherein,whereupon,wherever,whether,which,while,whither,who,whoever,whole,whom,whose,why,will,with,within,without,would,yet,you,your,yours,yourself,yourselves","en_US":"a,about,above,across,after,afterwards,again,against,all,almost,alone,along,already,also,although,always,am,among,amongst,amoungst,amount,an,and,another,any,anyhow,anyone,anything,anyway,anywhere,are,around,as,at,back,be,became,because,become,becomes,becoming,been,before,beforehand,behind,being,below,beside,besides,between,beyond,bill,both,bottom,but,by,call,can,cannot,cant,co,con,could,couldnt,cry,de,describe,detail,do,done,down,due,during,each,eg,eight,either,eleven,else,elsewhere,empty,enough,etc,even,ever,every,everyone,everything,everywhere,except,few,fifteen,fifty,fill,find,fire,first,five,for,former,formerly,forty,found,four,from,front,full,further,get,give,go,had,has,hasnt,have,he,hence,her,here,hereafter,hereby,herein,hereupon,hers,herself,him,himself,his,how,however,hundred,ie,if,in,inc,indeed,interest,into,is,it,its,itself,keep,last,latter,latterly,least,less,ltd,made,many,may,me,meanwhile,might,mill,mine,more,moreover,most,mostly,move,much,must,my,myself,name,namely,neither,never,nevertheless,next,nine,no,nobody,none,noone,nor,not,nothing,now,nowhere,of,off,often,on,once,one,only,onto,or,other,others,otherwise,our,ours,ourselves,out,over,own,part,per,perhaps,please,put,rather,re,same,see,seem,seemed,seeming,seems,serious,several,she,should,show,side,since,sincere,six,sixty,so,some,somehow,someone,something,sometime,sometimes,somewhere,still,such,system,take,ten,than,that,the,their,them,themselves,then,thence,there,thereafter,thereby,therefore,therein,thereupon,these,they,thickv,thin,third,this,those,though,three,through,throughout,thru,thus,to,together,too,top,toward,towards,twelve,twenty,two,un,under,until,up,upon,us,very,via,was,we,well,were,what,whatever,when,whence,whenever,where,whereafter,whereas,whereby,wherein,whereupon,wherever,whether,which,while,whither,who,whoever,whole,whom,whose,why,will,with,within,without,would,yet,you,your,yours,yourself,yourselves"},"relevanssi_synonyms":[],"relevanssi_thousand_separator":"","relevanssi_throttle":"on","relevanssi_throttle_limit":"500","relevanssi_title_boost":"2.5","relevanssi_trim_logs":"30","relevanssi_txt_col":"#ff0000","relevanssi_update_translations":"","relevanssi_wpml_only_current":"off"}

Thank you in advance

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer