Rank Math breadcrumbs and GeneratePress

#150321
  • Resolved Truthdunk
    Rank Math free

    I tried to use this code for the breadcrumbs in GeneratePress -> functions.php:

    <?php if (function_exists(‘rank_math_the_breadcrumbs’)) rank_math_the_breadcrumbs(); ?>

    This did not work. I did get this error: https://ibb.co/qRk221Z

    In stead I used this code I found on the internet:

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

    This does work.

    Questions:

    1. Which code is better to use?
    2. If code 1 is better. How do I make it work?

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

    Thank you for contacting the support, and sorry for any inconvenience that might have been caused due to that.

    The 2nd block of code you shared will also work fine as the 1st code since they have the same function.

    They both work. The 1st code will only display the breadcrumbs to which theme file you put it into. The 2nd code will display the breadcrumbs across your website content.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Thanks! That did help. Then option 2 is better for me, because it shows across my whole website.

    Febby
    Rank Math free

    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 ‘Rank Math breadcrumbs and GeneratePress’ is closed to new replies.