Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter mkwm

    (@mkwm)

    // Change rel='next' to something else.
    add_action( 'aioseop_next_link', 'change_next_url' );
    
    function change_next_link( $current_url ){
      return 'https://mynewurl.com/';
    }
    
    // Remove rel='prev'.
    add_action( 'aioseop_prev_link', '__return_false' );

    Here it removes in general. But I want to be just for the home page.

    Plugin Author arnaudbroes

    (@arnaudbroes)

    You can do something like this inside the action callback:

    add_action( 'aioseop_next_link', 'change_next_url' );
    
    function change_next_link( $current_url ){
      if ( ! is_front_page() ) {
         return $current_url;
      }
      return 'https://mynewurl.com/';
    }
    
    add_action( 'aioseop_prev_link', 'disable_prev_link' );
    
    function disable_prev_link( $current_url ){
      if ( ! is_front_page() ) {
         return $current_url;
      }
      return false;
    }

    You’ll have to test this yourself since I just quickly wrote this based on what you posted in your previous comment.

    Thread Starter mkwm

    (@mkwm)

    This function removes completely. including category and homepage

    Can you give me a cod that can only be valid for the homepage?

    Thread Starter mkwm

    (@mkwm)

    To be better understood

    Here, the homepage is also closed (rel=”next” href=”) https://help724.com/

    Here it is open in categories. (rel=”next” href=”) https://help724.com/category/web-tasarim/

    If you look at the homepage, you will see that there is no pagination.

    However, when looking at html, there is a pagination label.

    Thread Starter mkwm

    (@mkwm)

    I have not received a reply for a long time. No solution?

    Plugin Author arnaudbroes

    (@arnaudbroes)

    I just had a look at your website and saw that your homepage is paginated. You’ve set it to display the latest posts of your site, which will cause WordPress to automatically paginate it if you have more than a set amount of posts, so what the plugin is doing in this case is correct as far as I’m aware. https://help724.com/page/2/ is a valid URL.

    This should probably work if you still want to remove it for the homepage –

    add_action( 'aioseop_next_link', 'change_next_url' );
    
    function change_next_link( $current_url ){
      if ( ! is_front_page() ) {
         return $current_url;
      }
      return false;
    }

    I’m afraid I’m not able to test that myself since our support on these forums typically doesn’t extend to writing code.

    Thread Starter mkwm

    (@mkwm)

    I opened the numbering when I received a late reply from you, does not work in the code above.

    I think I need to continue with pagination

    Thank you…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘remove rel=next on home page but not others’ is closed to new replies.