How to get breadcrumb titlte

#438683
  • Resolved Sam Underwood
    Rank Math pro

    Is there a function to get the breadcrumb title of a post? For example, like get_the_title(), but it retrives the RankMath breadcrumb title instead (e.g. something like get_the_breadcrumb_title)

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Nigel
    Rank Math business

    Hello,

    Thank you for contacting Rank Math for help with retrieving the Rank Math breadcrumb title.

    There is no ready-made function to get the current Rank Math breadcrumb title. You will have to modify the full breadcrumb to show only the title. You can use the following filter as a starting point:

    
    /**
     * 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);
    

    Hope that helps. Please let us know if you have questions.

    Can a function for this be considered for future versions please?

    Hello,

    The breadcrumb title is taken from the title of the page.

    Unless you are modifying the breadcrumbs output, you can simply call the get_the_title() to get the breadcrumb title.

    Don’t hesitate to get in touch if you have any other questions.

    You can modify the breadcrumb title for each page within the RankMath settings for each page.

    get_the_title() gets the title of the post. I want to get the customized RankMath breadcrumb title.

    Nigel
    Rank Math business

    Hello,

    Thank you for the clarification, it helped us understand what you want to achieve.

    You can replace get_the_title() with the function RankMath\Paper\Paper::get()->get_title() which gets the rendered SEO title.

    Hope that helps. Please let us know if you have questions.

    Hey, this gets the page title tag, not the breadcrumb title – https://imgur.com/lcrEloD

    Nigel
    Rank Math business

    Hello,

    Thank you for your patience as we look into how to get the custom breadcrumb title with a function.

    You can use the function get_post_meta( get_the_id(), 'rank_math_breadcrumb_title', true );.

    Hope that answers you. Please let us know if you have questions.

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

The ticket ‘How to get breadcrumb titlte’ is closed to new replies.