Breadcrumbs rankmath for custom post type

#88212
  • Resolved John M
    Rank Math free

    Hello,
    I am a previous user of yoast and I need to guide me to have same fix for rank math.
    So I have created some post type direct in functions.php and while using yoast I have added this snippet so I can add before the breadcrumbs the parent title.

    add_filter( 'wpseo_breadcrumb_links', 'servicii_yoast_fix' );
    function servicii_yoast_fix( $links ) {
    global $post;
    if( is_singular('servicii')){
    $breadcrumb[] = array(
    'url' => site_url( '/servicii/' ),
    'text' => 'Servicii',
    );
    	array_splice($links, 1, -2, $breadcrumb);
    }
    return $links;
    }

    I would like to know if there is any filter available for rank math too.
    Many thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Alberto
    Rank Math business

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    I am pretty sure it can be achieved in Rank Math but I would like to better know what you want to do (maybe there is a more optimized way in Rank Math). Do you want to replace some path in the breadcrumbs with the custom one you added?

    If yes, this filter would be perfect for you: https://rankmath.com/kb/filters-hooks-api-developer/#change-remove-breadcrumb-items

    Looking forward to helping you. Thank you.

    ​​​​​​​

    removed

    John M
    Rank Math free

    Hello,
    I have some custom post type and somehow the breadcrumbs are not taking the parent page, so I need to modify the code above so I can add custom items in the breadcrumb based on the custom post type.
    Thanks.

    Alberto
    Rank Math business

    Hello @johnm-2,

    Which modifications do you need to do? Could you give us some samples?

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

The ticket ‘Breadcrumbs rankmath for custom post type’ is closed to new replies.