Changing global breadcrumb title on custom post type

#64940
  • Resolved Anonymous
    Rank Math free

    Is there any way to change a breadcrumb title globally across a site on a custom post type archive? In Yoast, there is an option to do this. Anything similar in RankMath? I already know about the way to do this individually on a post, but this won’t work for someone with thousands of custom post types.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 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.

    Meanwhile, we don’t have an option (yet) to update all the breadcrumb titles in bulk, you can achieve it using the filters in our API. If you know about coding (or if you have some dev or freelancer), you can achieve it pretty easily, I have done a little custom filter for you:

    /**
     * this is an example to remove the second item in your post breadcrumbs
     * Allow changing or removing the Breadcrumb items
     *
     * @param array       $crumbs The crumbs array.
     * @param Breadcrumbs $this   Current breadcrumb object.
     */
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
            // Check if we are viewing single posts
    	if(is_singular('post')){	
                    // Apply here your custom login to generate the final
                    // element of the breadcrumb (the breadcrumb title)
                    $newBreadcrumbTitle = "example";
                    // The last element in the $crumbs array is the post's
                    // breadcrumb title, so we have to update it:
                    $crumbs[count($crumbs)-1] = $newBreadcrumbTitle;
    	}
            // And return the breadcrumbs
    	return $crumbs;
    }, 10, 2);

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Anonymous
    Rank Math free

    Great thank you! Was able to tweak that and make it work for what we needed.

    Have a nice weekend.

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘Changing global breadcrumb title on custom post type’ is closed to new replies.