I use the Breadcrumb NavXT 7.1.0 plugin on the site.
An ajax-filter is implemented in the "News" section: when you follow a link like mysite.com/news/?country=turkey, only news about Turkey remains on the page.
/* frontend */
$(document).ready(function() {
let slug = window.location.href.split('=').pop();
$.ajax({
cashe: false,
method: 'post',
url: '<?php echo get_template_directory_uri(); ?>/news-ajax-sort.php',
data: slug,
success: function(data) {
$('.all-news-wrap').append(data);
}
});
})
/* backend */
$keys = array_keys($_POST);
$newsslug = $keys[0];
if(isset($newsslug)) {
$news_args = array(
'post_type' => 'news',
'posts_per_page' => 100,
'tax_query' => array(
array(
'taxonomy' => 'country_news',
'field' => 'slug',
'terms' => $newsslug
)
)
);
}
else {
$news_args = array(
'post_type' => 'news',
'posts_per_page' => 100
);
}
//here is the standard wordpress loop
At the same time, in the “breadcrumbs” the path is indicated to the main section:
Home | News
After a while, the task appeared to create a completely similar section "Events", only the ajax filter is not by country, but by year. It's a full copy of the "News", the settings in Breadcrumb NavXT are identical. But when following a link like mysite.com/events/?years=2023 I get in the "breadcrumbs":
Home | Events | 2023
That is, there is a kind of transition to an unnecessary subsection, which in theory should not be (in any case, there is no such thing with the "News").
Why are sections that are absolutely identical in implementation handled differently by the plugin?
How does the plugin form a subsection from a get-request, and how can it be influenced?
I thought that maybe the problem was in the numbers, and substituted the word "events" in front of them (mysite.com/events/?years=events2023), but it didn't work. I got in the "breadcrumbs":
Home | Events | events2023