Show Slug instead Title of Pages in Breadcumbs

#69538
  • Resolved Rafael Jaén Quero
    Rank Math free

    Hello, in my website i have parent pages and child-pages.

    When breadcumbs are active they show: Home >> Parent Page Title >> Child Page title.

    I usually have long Page titles, and i prefer to show breadcumbs (without “-” ) instead the complete Page title.

    How can i achieve that?

    Thank you!

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.

    Could you post a sample of your current breadcrumbs and another with the breadcrumbs you will like to achieve for the same URL?

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Example:

    I have two different pages (Parent page and Child Page)

    Parent Page title is: “I am your father”
    Parent Page slug is: ‘parent-page’

    Child Page title is: “I am a son”
    Child Page slug is: ‘child-page’

    I actually have the follow breadcumbs:
    Home >> I am your father >> I am a son

    And i want to achieve: (Slugs without “-” and capitalized instead the titles)
    Home >> Parent Page >> Child Page

    Thank you!

    Alberto
    Rank Math business

    Hello,

    I think you should use there some custom code using our API, there you could modify the breadcrumbs as you want (but you need to know a little about coding). This is the snippet you should use as a start:

    /**
     * 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 ) {
    	return $crumbs;
    }, 10, 2);

    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 3 replies - 1 through 3 (of 3 total)

The ticket ‘Show Slug instead Title of Pages in Breadcumbs’ is closed to new replies.