Disable Breadcrumbs on a few pages

#417183
  • Resolved Cecilia
    Rank Math free

    Hi there, I need to disable Breadcrumbs on 10 pages.
    Can it be disabled from css or with Code Snippets?
    Thanks in advance.
    Cecilia

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

    Thank you for contacting Rank Math support and bringing your concern to our attention.

    If you have applied our breadcrumbs code in your theme template files, you can add a condition statement to exclude specific pages using their IDs. Please refer to this code:

    global $post;
    if (function_exists('rank_math_the_breadcrumbs') && !in_array($post->ID, array(72, 102, 110)) ) {
      rank_math_the_breadcrumbs();
    };

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

    Cecilia
    Rank Math free

    Hello Jeremy, I added the code that you detail below the code of
    <?php if (function_exists(‘rank_math_the_breadcrumbs’)) rank_math_the_breadcrumbs(); ?>

    And the page shows the transcript of the code.” <?php if (function_exists(‘rank_math_the_breadcrumbs’)) rank_math_the_breadcrumbs(); ?>”

    I don’t know if I added the page ids in the right place.
    The pages I want to exclude are: 2098, 2070, 2077, 2195, 2085, 2101, 2117, 2122.
    So I added the following code in Page.php, I use Generatepress Theme.
    Thank you
    Cecilia

    Hello,

    Please remove all other breadcrumb filters of our plugin and add the one given below:

    global $post;
    if (function_exists('rank_math_the_breadcrumbs') && !in_array($post->ID, array(2098, 2070, 2077, 2195, 2085, 2101, 2117, 2122)) ) {
      rank_math_the_breadcrumbs();
    };

    This should remove the breadcrumbs from the pages with the mentioned IDs in the filter.

    Hope this helps. Let us know if you need any other assistance.

    Cecilia
    Rank Math free

    Hello Jaideep Asrani,
    Thanks for your answer. I added the code on page.php (Generatepress Theme) and the page shows the breadcrumb and below show the same code:
    global $post; if (function_exists(‘rank_math_the_breadcrumbs’) && !in_array($post->ID, array(2098, 2070, 2077, 2195, 2085, 2101, 2117, 2122)) ) { rank_math_the_breadcrumbs(); };

    I think that it is not taking the code well or I have to add it somewhere else.
    Thanks in advance.
    Cecilia

    Cecilia
    Rank Math free

    In summary, page.php contains the following code:

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

    global $post;
    if (function_exists(‘rank_math_the_breadcrumbs’) && !in_array($post->ID, array(2098, 2070, 2077, 2195, 2085, 2101, 2117, 2122)) ) {
    rank_math_the_breadcrumbs();
    };

    Anas
    Rank Math business

    Hello,

    Please remove this code from the file:
    remove

    Then, add this code:

    <?php global $post;
    if (function_exists('rank_math_the_breadcrumbs') && !in_array($post->ID, array(2098,2070,2077,2195,2085,2101,2117,2122))) rank_math_the_breadcrumbs(); ?>

    Hope this helps.

    Thank you.

    Cecilia
    Rank Math free

    It worked!! Thank you very much Anas, Jaideep Asrani, Jeremy, for your help and quick response.
    I’m very happy, it looks great!!

    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 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this ticket.