D
D
Delerom2021-11-03 21:00:11
WordPress
Delerom, 2021-11-03 21:00:11

How to change breadcrumbs for Woocommerce product categories?

How can I set a breadcrumb title for a Woocommerce product category ? Yaost Seo - does not change. You can't even put something in the "Title for navigation chains" input. I also made a custom field "bread_custom_name" for writing the title (I wrote the necessary titles for all categories into it), I display it through NavXT Breadcrumbs and change the title with this function:



add_filter('bcn_breadcrumb_title', 'my_breadcrumb_title_swapper', 3, 10);

function my_breadcrumb_title_swapper($title, $type, $id)
{

    $post_id = get_queried_object()->term_id;
    //   $meta_value = get_term_meta( get_queried_object()->term_id, 'bread_custom_name', false );

    if ($post_id == $id) {
        if (get_term_meta( get_queried_object()->term_id, 'bread_custom_name', false )) {
            $meta = get_term_meta( get_queried_object()->term_id, 'bread_custom_name', false );
            $title = $meta[0];
        }
    }
    

    return $title;
    return $type;
    return $id;
}

But it changes the title only for the category where we are, for others it displays the title of the category.
6182cd8b2dcce895313568.png

Are there any solutions?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question