Breadcrumbs - Wrong link in category archives

When I enabled breadcrumbs, clicking “Blog Home” when reading a blog post would take me to the homepage instead of the blog home. I was able to fix that with this solution here: https://theme.co/apex/forum/t/breadcrumbs-wrong-link/43079

Now my question is, how can I fix the same issue on my categories archives page?

My breadcrumbs look like this: Home > Blog Home > Category but when I click “Blog Home”, it takes me to “Home”

Any ideas on how to fix this? I’m not very good with PHP code and I wasn’t able to customize the solution from this thread to my exact situation: https://theme.co/apex/forum/t/breadcrumbs-showing-wrong-post-category/42931/2

Thanks!

Hi Thor,

Thanks for reaching out.

It should be the same cod but with added condition

add_filter('x_breadcrumbs_data', 'post_parent_trail', 9999999, 2);
function post_parent_trail ($crumbs, $args) {
	if ( is_singular('post') || is_category() ) {
		$crumbs[1]['url'] = "https://www.vesti-olsen.dk/nyheder/";
	}
	return $crumbs;  
}

Please replace the code you implemented with that, it’s from the first thread you have provided by modified a bit.

Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.