RankMath Breadcrumb for ACF taxonomy page

#716755
  • Resolved Kasper
    Rank Math free

    I have a WordPress website that is using RankMath and Advanced Custom Fields Pro (ACF Pro). My RankMath breadcrumbs does not display the format properly at the moment, and I want to fix that.

    I have this ACF taxonomy, Genre (It does not have a physical archive page). I have then created a Genre called Biografier (https://bookpare.dk/g/biografier/).

    The Rankmath breadcrumb correctly displays the structure on the custom post type page (https://bookpare.dk/lydbog/spionchefen-erindringer-fra-celle-18/):
    Hjem – Lydbøger – Biografier – Spionchefen – Erindringer fra celle 18

    However, the breadcrumb does not correctly show the relationship on the genre page (https://bookpare.dk/g/biografier/): Hjem – Genre – Biografier

    It is missing the Lydbøger page. How can i create this link, so that the genre page https://bookpare.dk/g/biografier/ correctly shows the breadcrumb as here: Hjem – Lydbøger – Biografier

    I have tried to use this PHP code (shown below) in my functions.php, but the breadcrumb still doesn’t show what i want on this taxonomy page: https://bookpare.dk/g/biografier/

    Can you please help me fix this. I want the breadcrumbs on that page to be Hjem – Lydbøger – Genrer – Biografier

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs ) {
        if ( is_tax( 'genre' ) ) {
            array_splice($crumbs, 1, 0, array(array(
                'url' => get_post_type_archive_link('lydboeger'),
                'label' => 'Lydbøger'
            )));
        }
        return $crumbs;
    }, 10, 1);
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    I apologize for the inconvenience you’re experiencing with the Rank Math breadcrumbs on your ACF taxonomy page. Thank you for providing the PHP code you’ve tried to use to fix the issue.

    To ensure that the breadcrumb correctly shows the relationship on the genre page, you can use the following PHP code snippet:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs ) {
        if ( is_tax( 'genre' ) ) {
            array_splice($crumbs, 1, 0, array(array(
                'url' => home_url('/lydbog/'), // Replace with the URL of your Lydbøger page
                'label' => 'Lydbøger'
            )));
        }
        return $crumbs;
    }, 10, 1);

    Replace home_url('/lydbog/') with the actual URL of your “Lydbøger” page. Once you’ve added this code to your functions.php file, it should correctly display the breadcrumb as “Hjem – Lydbøger – Genrer – Biografier” on the taxonomy page.

    If you encounter any further issues or need additional assistance, please feel free to reach out. We’re here to help.

    Sources:
    How to Customize Breadcrumbs in Rank Math » Rank Math
    Multilingual SEO with Rank Math SEO & WPML » Rank Math
    How to Enable Breadcrumbs on Your Website With Rank Math SEO » Rank Math

    Hello,

    Thank you for contacting Rank Math support.

    We have replied to your other ticket and are closing this one. Please check the reply there.

    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 ‘RankMath Breadcrumb for ACF taxonomy page’ is closed to new replies.