Breadcrumb shows "Home - Blog - pagename" for all pages

I have selected each of the pages to see if the parent is assigned to the news page but I can not find an instance of that but all of the pages each show that Blog is the parent. I don’t have a blog page assigned in WP Settings because as soon as I do you seem to push it into a page with a side panel and no options for other settings.

Can you take a look and see what is happening. I will give you login info

Hello @GeorgiaG,

Thanks for writing in! The blog is displaying and is linking to the News and Updates page because you may have assigned this page as your post page before. It is already saved in the database and the breadcrumb is using the page assignment. I would recommend that you re assign a new page so that it will display a different one.

To hide blog text in breadcrumbs, kindly add this code to your child theme’s functions.php file.

function my_breadcrumbs_data( $args  ) {    
    $args["blog_label"] = "";
    return $args;
}

add_filter( 'x_breadcrumbs_data_args', my_breadcrumbs_data );

We would loved to know if this has work for you. Thank you.

I do not mind ‘Blog’ or “News and Updates” showing if they are correctly part of the path but it is showing instead of the parent page. So the final destination is a page… not a post and yet it show as though it is part of a post tree.

Hey @GeorgiaG,

The “Blog” is supposed to display only in single blog posts. It should not display in pages. It is added in the breadcrumb as if it is the parent page item.

I noticed that you are using an older version(2.2.5). Pro 2.3.8 is now available in automatic updates! This release contains fixes for several issues so be sure to check out the changelog (https://theme.co/changelog/). Please do update to the latest version first. After doing the updates, always remember to clear all caches when updating so that the code from the latest release is always in use. This will help you to avoid any potential errors.

Please let us know how it goes.

It did not help. The URL says https://staging.sowinteraction.com/our-programs/dance/
The breadcrumb says Home - News and Updates - Dance

  • News and Updates is our blog so that label is now appearing correctly but it should not appear here. The URL is the correct path.

Hi,

To fix it, please replace the code in your child theme’s functions.php file that reads

add_filter( 'x_breadcrumbs_data', 'x_blog_breadcrumb', 10, 2 );
function x_blog_breadcrumb($crumbs, $args){

    $crumbs[1] = array(
        'type'  => 'blog',
        'url'   => get_permalink(16199),
        'label' => $args['blog_label'],
    );
   
   
	 return $crumbs;
}

with this

add_filter( 'x_breadcrumbs_data', 'x_blog_breadcrumb', 10, 2 );
function x_blog_breadcrumb($crumbs, $args){
    if(is_home() || is_singular('post')) {
    $crumbs[1] = array(
        'type'  => 'blog',
        'url'   => get_permalink(16199),
        'label' => $args['blog_label'],
    );
   
    }
	 return $crumbs;
}

Hope that helps.

1 Like

A perfect fix. Thank you very much! It fixed both issues I was having. Best.

You’re welcome, glad we could help.

Cheers!

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