change Breadcrumb link from category to page

#774790
  • Resolved Anonymous
    Rank Math free

    Is it possible to change breadcrumb links from a category to a page?

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

    I apologize for the inconvenience you are facing. To change the breadcrumb links from a category to a page in Rank Math, you can follow these steps:

    1. Changing Primary Taxonomy: You can set the Primary Taxonomy for your post type under WordPress Dashboard → Rank Math SEO → Titles & Meta → Posts. This will help customize the taxonomy used for the breadcrumbs.

    2. Using Custom Code Snippets: If you want to modify your breadcrumbs beyond the options available in the settings, you can add custom code snippets to your site. Here is an example of a code snippet that can be used to display breadcrumbs except on the homepage:

    1. Removing Breadcrumb Categories: You can also use a filter to remove categories from being displayed in the breadcrumbs of your posts and pages. Here is an example of a filter that can achieve this:
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) { 
        if(is_singular('post')){ 
            unset($crumbs[1]); 
            $crumbs = array_values($crumbs); 
            return $crumbs; 
        } 
        return $crumbs; 
    }, 10, 2);

    By following these steps, you can customize your breadcrumbs in Rank Math to change the links from categories to pages. If you need further assistance or have any questions, feel free to reach out to our dedicated support team here.

    Thank you for reaching out and giving us the opportunity to assist you with your query. Let us know if there is anything else we can help you with.

    Sources:
    How to Enable Breadcrumbs on Your Website With Rank Math SEO » Rank Math
    How to Customize Breadcrumbs in Rank Math » Rank Math
    How to Fix “Either ‘name’ or ‘item.name’ should be specified” Error » Rank Math

    Hello,

    Thank you for contacting us and bringing your concern to our attention.

    You can use and modify the following filter on your website to change the Rank Math breadcrumb items:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	return $crumbs;
    }, 10, 2);
    

    Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    If you want, you can share the actual breadcrumbs so that we can assist you in modifying the filter code.

    Looking forward to helping 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 2 replies - 1 through 2 (of 2 total)

The ticket ‘change Breadcrumb link from category to page’ is closed to new replies.