fbpx

How to Enable Breadcrumbs with Rank Math WordPress SEO Plugin

Breadcrumbs play a vital role in by allowing users to retrace their navigation path from the homepage to the current page they’re browsing.

Enabling the breadcrumbs has numerous benefits including better user experience, lower bounce rate, and easier crawling for search engine bots that results in an improvement in organic ranking.

Adding breadcrumbs to your WordPress website is quite easy. You can enable this feature with a toggle of a button in any popular SEO plugin including Yoast SEO and Rank Math.

However, some people are asking how to enable breadcrumbs with Rank Math SEO plugin.

If you are one who likes the Rank Math and doesn’t want to move back to Yoast or any other WordPress SEO plugin, then follow this short tutorial.

How to Enable Breadcrumbs with Rank Math WordPress SEO Plugin

There are a few themes which don’t need an additional setup to enable the breadcrumbs including all MyThemeShop themes.

Other themes require to put a small snippet of code to the functions.php file to display breadcrumbs on front-end.

Before that, you must enable the Rank Math Breadcrumbs by navigating WP-Admin >> Rank Math >> General Settings >> Breadcrumbs >> Enable breadcrumbs function.

Rank Math Breadcrumbs
Rank Math Breadcrumbs – General Settings

Method 1 – Modifying Functions.php file

You can use this method for enabling rank math breadcrumbs in any WordPress theme. If you’re a complete beginner, make sure to keep a backup copy of your website.

Now, log into your WordPress admin dashboard and follow the path Appearance >> Editor >> functions.php and add the following code at the bottom of the page.

add_filter( 'the_content', function( $content ) {
if( function_exists( 'rank_math_get_breadcrumbs' ) ) {
$content = rank_math_get_breadcrumbs() . $content;
}
return $content;
});

Click on the Update File button to save the changes you’ve made in the functions.php file.

Important: If you update/change the WordPress theme, then you may need to reinsert this code to enable the rank math breadcrumbs.

If you want to customize further the appearance for rank math breadcrumbs displayed on your website, you can add the following code under Appearance >> Customize >> Additional CSS and hit Publish button to save the changes.

.rank-math-breadcrumb {
font-size: 18px;
border: 1px solid #00abf0; padding-left: 25px;
padding-top: 15px;
padding-right: 15px;
margin-bottom: 20px;
}

Method 2 – Adding PHP code through Hooks

This method works only if the WP theme supports an application of Hooks. E.g., GeneratePress Premium.

Once you have activated breadcrumbs option in Rank Math SEO plugin, simply pick the code snippet provided by MyThemeShop and add to the custom hook of WordPress template.

If you’re using GeneratePress Premium WordPress theme, then you need to enable Elements module under Appearance >> GeneratePress.

In the Elements, Add new Hook by navigating Appearance >> GeneratePress >> Elements >> Add New >> Hook and give a preferred name — Rank Math Breadcrumbs.

Add the following code in the Hook editor.

<?php if (function_exists('rank_math_the_breadcrumbs')) rank_math_the_breadcrumbs(); ?>

Select the following settings and Publish the hook to display SEO breadcrumbs on the page load.

Setting

Hook: before_entry_title

Execute PHP: [✓]

Display Rules

Location: Post [All Posts]

Exclude: All Archives

Users: All Users

Method 3 – Adding Shortcode

If you think, the above methods are too complex to understand, then you can use a simple shortcode to display Rank Math breadcrumbs wherever you want. (Don’t forget to remove spaces).

[ rank_math_breadcrumb ]

Summary

SEO Breadcrumbs are useful navigation aid for both users, as well as, search engine crawlers. You can enable them using one of the methods mentioned above and see improvements in your organic traffic.

You May Also Like

12 thoughts on “How to Enable Breadcrumbs with Rank Math WordPress SEO Plugin”

      • Hi Ankit, I was trying to add breadcrumbs before post title, but I couldn’t. I tried this:
        add_filter(‘generate_after_header’, ‘the_content’, function( $content ) {
        if( function_exists( ‘rank_math_get_breadcrumbs’ ) ) {
        $content = rank_math_get_breadcrumbs() . $content;
        }
        return $content;
        });

        Reply
        • Unfortunately, the above code does not work on all themes. That’s why I have enlisted alternate ways to add breadcrumbs. BTW, which theme do you use?
          If you’re using a WordPress theme that uses hooks, (e.g., GeneratePress Premium), then you can use the second method.

          Reply
  1. Thank you very much for the article, I had problems with this topic and I did not know where to put the Rank Math code, also the css code was very helpful.

    Reply
  2. Hi… Thanks for this great tutorial. Just implemented it on my site, and worked like breeze. But I had a little issue while trying to style it using the CSS code snippet you provided.
    I adjusted it to suit my need like this;

    .rank-math-breadcrumb {
    font-size: 16px;
    border: 3px solid #002b5a;
    padding-left: 5px;
    padding-top: 3px;
    padding-right: 5px;
    margin-bottom: 10px;
    }
    Ref. Url: www. droidafrica. net/list-of-infinix-smartphone-to-get-android-90-pie/

    My question is, like in the URL above, how can reduce the border also, to look similar to the top border?

    Thanks for your reply

    Reply
    • Sorry for the typo: I mean how can I reduce the bottom border between the breadcrumb and borderline, to make it have the same space between the top border and breadcrumb?

      Reply
  3. Thank you this useful post. I love Genesis theme, but bradcrumbs was a little bit odd, You are here 🙂 I used method with modifying functions.php and now looks great. Thank again.

    Reply
    • Hi Jose,
      Sorry for the inconvenience, but we have enabled WP Copy Protection on our website to deal with content piracy. It was severely affecting our SEO efforts.
      However, the code snippet is very short to type, and you won’t mind doing that.
      BTW, thanks for landing by here.

      Reply
  4. Before a week, I moved from Yoast SEO to Rank Math as I saw many positive reviews from WordPress users.
    But I was unable to add breadcrumbs since I’m not much techy. I started using shortcode at the beginning of each post but it seems time-consuming.
    Your post helped me solve my problem and now I have added breadcrumbs to my site. Thanks.

    Reply

Leave a Comment