Customized Breadcrumbs

#474811
  • Resolved treycopeland
    Rank Math free

    I have a custom post type called Campgrounds and taxonomy with City/State.

    On my archive pages, it’s fine: removed

    However, on the custom taxonomy pages, it only shows Campgrounds -> Hardrick Creek
    removed

    How can I get the campground single pages breadcrumb to be like Camprounds->Alabama->Abbeville->Hardridge Creek

    I’m using this code below:

    add_filter( ‘rank_math/frontend/breadcrumb/items’, function( $crumbs, $class ) {
    if(is_singular(‘campgrounds’)){
    $modifiedCrumb = array(
    “0” => esc_html(‘Campgrounds’),
    “1” => esc_url(‘/campgrounds/’),
    “hide_in_schema” => false
    );
    $crumbs[count($crumbs)-2] = $modifiedCrumb;
    }
    var_dump($crumbs); //view breadcrumb structure.
    // And return the breadcrumbs
    return $crumbs;
    }, 10, 2);

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

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

    You don’t need the filter code for that as it is possible to show the category/taxonomy hierarchy using the correct settings in Rank Math.

    Please head over to your WordPress Dashboard > Rank Math > Titles & Meta > Post Types: Campgrounds and ensure you selected “Locations” as your Primary Taxonomy.

    tax

    Let us know how that goes. Looking forward to helping you.

    This worked. Thank you!

    Anas
    Rank Math business

    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 ‘Customized Breadcrumbs’ is closed to new replies.