get article breadcrumbs include archive path

#985737
  • Resolved Factory
    Rank Math free

    Hello,
    i’m trying to use rankmath breadcrumbs for my articles without success, or to be exact i cannot get what i need.
    Breadcrumbs are on, and working great on archive pages.
    But when i open an article there’s no “mention” about the archive path.

    Ex.
    on url mysite.it/2025/03/08/ i get the “Home » 2025 » Marzo » 08” and it’s correct.
    When i open an article
    mysite.it/2025/03/08/article/ as breadcrumb i only get “Home » Article title”

    I am using permalink “permalink-input-day-name” as “/%year%/%monthnum%/%day%/%postname%/”

    Is there a way to include the full “path” in the breadcrumb?

    Actual breadcrumbs_archive_format is “%s”

    Thanks in advance for your reply

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

    We apologize for the issue you are facing with the breadcrumbs on your articles. To include the archive path in the breadcrumbs for your articles, you will need to adjust the settings in Rank Math.

    Here are a few steps you can follow:

    1. Check Breadcrumb Settings: Ensure that you have configured the breadcrumbs settings correctly. You can do this by navigating to Rank Math > General Settings > Breadcrumbs in your WordPress dashboard.

    2. Archive Format: Since you mentioned that your breadcrumbs_archive_format is set to %s, this should typically include the taxonomy or category name. Make sure that your articles are assigned to the correct categories or taxonomies that you want to appear in the breadcrumbs.

    3. Hide Taxonomy Name: Ensure that the Hide Taxonomy Name option is disabled. If this option is enabled, it will remove the taxonomy name from the breadcrumbs of archive pages.
      Breadcrumbs - Hide Taxonomy Name

    4. Check Post Settings: When editing an article, check the Rank Math Meta Box under the post editor. In the Advanced Tab, ensure that the breadcrumb title is set correctly and that it reflects the desired structure.

    5. Theme Compatibility: Sometimes, themes may override breadcrumb settings. Ensure that your theme is compatible with Rank Math and does not have its own breadcrumb functionality that could conflict with Rank Math’s settings.

    If after checking these settings you still do not see the desired breadcrumb structure, please reply to this ticket with your site URL so we can assist you further. A human agent from our support team will take over and help resolve this issue.

    Thank you for raising this concern!

    Sources:
    How to Enable Breadcrumbs on Your Website With Rank Math SEO » Rank Math

    I’m using the standard “twenty twenty five” theme, and there’s only rankmath breadcrumbs active.
    Doublechecked any steps

    Hello,

    Thank you for your patience.

    In this case, you can use and customize this filter to add the year month and day in each of the breadcrumbs:

    add_filter('rank_math/frontend/breadcrumb/items', function($crumbs, $class) {
        if (is_single()) {
            // Get the current post
            global $post;
    
            // Get the date of the post
            $year = get_the_date('Y', $post);
            $month = get_the_date('F', $post); // Full month name
            $day = get_the_date('d', $post);
    
            // Create the URL for each part
            $year_url = get_month_link($year, '01'); // Link for the year (using January as a placeholder)
            $month_url = get_month_link($year, get_the_date('m', $post));
            $day_url = get_day_link($year, get_the_date('m', $post), $day);
    
            // Add each part to the breadcrumb array
            $crumbs[1] = array(
                'text' => $year,
                'url'  => $year_url,
            );
            
            $crumbs[2] = array(
                'text' => $month,
                'url'  => $month_url,
            );
    
            $crumbs[3] = array(
                'text' => $day,
                'url'  => $day_url,
            );
    
            // Add the post title as the last breadcrumb
            $crumbs[4] = array(
                'text' => get_the_title($post),
                'url'  => get_permalink($post),
            );
        }
    
        return $crumbs;
    }, 10, 2);

    If you’re not sure how to add this code, you can follow this guide:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how this goes.

    just noticed,
    with print_r($crumbs);
    i see 2 times the array

    Hello,

    Please replace the filter code with the following one and see if that works for you:

    add_filter('rank_math/frontend/breadcrumb/items', function($crumbs, $class) {
        if (is_single() && !empty($crumbs)) {
            global $post;
    
            $year  = get_the_date('Y', $post);
            $month = get_the_date('F', $post);
            $day   = get_the_date('d', $post);
    
            $year_url  = get_year_link($year);
            $month_url = get_month_link($year, get_the_date('m', $post));
            $day_url   = get_day_link($year, get_the_date('m', $post), $day);
    
            /
            $date_breadcrumbs = [
                [$year, $year_url],
                [$month, $month_url],
                [$day, $day_url],
            ];
    
            // Ensure the first element is "Home" (correct structure)
            if (!isset($crumbs[0][0])) {
                array_unshift($crumbs, ['Home', home_url('/')]);
            }
    
            array_splice($crumbs, 1, 0, $date_breadcrumbs);
        }
    
        return $crumbs;
    }, 10, 2);
    

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

    Thank you.

    Thanks a lot, working perfectly!

    Hello,

    You’re welcome.

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

    If it isn’t too much to ask for – would you mind leaving us a review here?
    https://www.trustpilot.com/evaluate/www.rankmath.com
    https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post

    It only takes a few minutes but it makes a huge difference.

    It would mean so much to us and would go a really long way.

    Thank you.

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

The ticket ‘get article breadcrumbs include archive path’ is closed to new replies.