how to remove rel=next on home page but not others

#785113
  • kiani allper
    Rank Math free

    hi
    I’m trying to remove the rel=next link from my WordPress homepage but keep it on other pages. I’m currently using Rank Math for my SEO management.

    I understand Rank Math might not directly control this functionality, but I wanted to check if there are any settings or known conflicts that might be causing the rel=next link to appear on the homepage even when I don’t want it.
    My website URL is: https://allperfect.co/

    If there’s no way to achieve this through Rank Math settings, could you please advise on any alternative recommendations?

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

    I apologize for the issue you are facing with the rel=next link on your WordPress homepage. To remove the rel=next link from your homepage while keeping it on other pages, you can follow these steps:

    1. Navigate to your WordPress Dashboard.
    2. Go to AppearanceTheme File Editor.
    3. Select the functions.php or rank-math.php file from your theme files.

    Navigate to Theme File Editor

    1. Add the following code snippet to remove the rel=next link from the homepage:

      /**
       * Filter to remove rel=next link from the homepage
       */
      add_filter( 'rank_math/frontend/remove_next', '__return_true' );
    2. Click Update File to save the changes.

    By adding this code snippet, you will be able to remove the rel=next link specifically from your homepage while keeping it on other pages.

    If you encounter any difficulties or need further assistance, please feel free to reach out to our support team by visiting Rank Math Support. Our team is available 24×7 and will assist you promptly.

    Thank you for reaching out with your concern. Let me know if there is anything else I can help you with.

    Sources:
    Remove “rank-math-link” Class from All Outbound Links » Rank Math
    Rank Math General Settings
    How to Disable All Rank Math Generated SEO Tags » Rank Math

    This is an automated reply from Rank Math Support Bot. Your ticket has been assigned to a human agent and we will get back to you shortly.

    kiani allper
    Rank Math free

    Dear Rank Math Support,

    Thank you for the provided instructions on how to remove the rel=next link from my homepage. I followed the steps carefully and added the code snippet to my theme’s functions.php file. However, unfortunately, the rel=next link is still present on the homepage.

    To help diagnose the issue further, here’s some additional information:

    I confirmed I saved the changes to the file after adding the code snippet.
    I cleared my website cache after making the changes ( total cache ).
    I checked the source code of my homepage and verified the rel=next link is still present.
    Is there anything else I can try to troubleshoot this issue, or perhaps an alternative approach using Rank Math’s settings that I might have missed?

    Thank you again for your assistance.

    Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for the delay and for any inconvenience this issue may have caused you.

    In this case, you may use and customize this filter to remove the rel=next in the page’s source code (replace the former with this):

    /**
     * Allows developers to handle rel="next" / rel="prev" by themselves.
     *
     * @param bool $links_generated Whether or not to handle rel="next" / rel="prev" links.
     */
    add_filter( 'rank_math/frontend/disable_adjacent_rel_links', '__return_true' );

    And here’s a guide to adding the filter to your website:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps.

    Thank you.

    Hello,

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

    We checked your homepage but were not able to find the adjacent links there:

    However, in order to remove the adjacent links from your homepage, you should use the following filter:

    add_filter( 'rank_math/frontend/disable_adjacent_rel_links', function( $remove ) {
        if ( is_front_page() || is_home() ) {
            return true;
        }
        return $remove;
    });
    

    Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Looking forward to helping you.

    Thank you.

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

You must be logged in to reply to this ticket.