How to remove ‘Product with tag’ in Breadcrumb

#630541
  • Resolved Anonymous
    Rank Math free

    Hey,

    I ‘ve a question:
    How to remove ‘Product with tag’ in Breadcrumb?

    https://ibb.co/cvH7Xfz

    Thanks!

    Regards,
    Kevin

Viewing 13 replies - 1 through 13 (of 13 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    Could you please share the affected URL so we can check as well?

    Meanwhile, you can choose the Categories instead in Rank Math > Titles & Meta > [Post Type] > Primary Taxonomy:
    https://rankmath.com/kb/how-to-choose-a-primary-category/#for-breadcrumbs

    Looking forward to helping you.

    Thank you.

    Anonymous
    Rank Math free

    Hey!

    Thanks for your reply.

    Sure, the URL is:
    https://supertemplates.nl/wandel-webshop/product-tag/outlet/

    This concerns the text “Producten met tag”. How can we take that away from the breadcrumb? It is not shown in the categories.

    I’d like to hear it from you.

    Regards,
    Kevin

    Hello,

    Thank you for sharing the URL.

    To change the breadcrumb title, edit the page and scroll down under the Advanced tab, you can place the new title:
    https://rankmath.com/kb/advanced-tab/#breadcrumb-title

    Advanced tab

    Hope that helps.

    Anonymous
    Rank Math free

    Hi Reinelle,

    Thanks for your reply.

    Unfortunately, this doesn’t work together. Because we work with e a template for the different categories/tags. Is there any other option to solve it?

    I like to hear it.

    Regards,
    Kevin

    Hello,

    Thank you for your patience.

    In this case, you may need to use and customize this filter to modify the name shown on the breadcrumbs:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	$post_type = get_post_type(get_queried_object());
    	
    	if ($post_type == 'your-post-type-name') { //change the exact post type name
    		$crumbs[1][0] = '"Outlet"'; //update to the actual breadcrumb
    	}
    
    	return $crumbs;
    }, 10, 2);

    If you’re unsure how to add this code, you can follow this guide:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how this goes.

    Anonymous
    Rank Math free

    Hi Reinelle,

    Thanks for your reply.

    I added your code via the functions.php in the child theme. However, I cannot find anywhere which post type name I should enter. Where can I find these?

    This is the URL of the product tag in any case:
    /wp-admin/term.php?taxonomy=product_tag&tag_ID=75&post_type=product&wp_http_referer=%2Fwandel-webshop%2Fwp-admin%2Fedit-tags.php%3Ftaxonomy%3Dproduct_tag%26post_type%3Dproduct

    I’d like to hear it from you.

    Hello,

    Thank you for your patience.

    From the link you shared, it seems that the post type is your product post_type=product

    Please try updating this line in the filter to $post_type == 'product'.

    If it’s still not applying, then we can check your site instead so we can investigate and apply the filter correctly.

    To do that, please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    Let us know how this goes.

    Anonymous
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    We have modified the code a bit and it is now working as intended. Kindly check from your end and see if works the same.

    Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.

    Anonymous
    Rank Math free

    Hi Jeremy,

    Thanks for your answer.

    I checked it, but unfortunately the breadcrumb with ‘Outlet’ is now visible on every page (see image).

    1. Can that be solved?
    2. Can we change the text from “Outlet” to Outlet

    I like to hear from you.

    Hello,

    1. We can see that the Outlet is showing on all product pages, other pages like your contact page show the correct breadcrumb. Here’s a screenshot:

    If you’re seeing something else, please share the page you’re referring to.

    2. We have modified the code again to remove the double quote from the breadcrumb. Please review it and let us know if it is working correctly now.

    Thank you for choosing Rank Math!

    Anonymous
    Rank Math free

    Hey!

    Thanks for your quick reply.

    Yes that’s right. But that is not the intention. The tag ‘Outlet’ is only required on the page about ‘Outlet’. The original category must be shown on the other product pages. How can we arrange that?

    I like to hear it.

    Hello,

    I have modified the code again to ensure that it is only affecting the product tag pages. Here’s the updated code:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	global $wp_query;
    	if (is_product_tag()) {
    		$term = $wp_query->get_queried_object();
    		$crumbs[1][0] = $term->name;
    	}
    
    	return $crumbs;
    }, 10, 2);

    If that wasn’t it, can you please confirm if you also wanted to modify the product pages, not just the product tags?

    We really look forward to hearing back from you. Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 13 replies - 1 through 13 (of 13 total)

The ticket ‘How to remove ‘Product with tag’ in Breadcrumb’ is closed to new replies.