• Resolved Svensson36

    (@svensson36)


    Hi,

    I really like your plugin!
    But now I have a problem with the hreflang tag on paginated pages (i.e. on pages likes this: http://www.mysite.de/blog/page/2/).

    The hreflang for all pages of the blog is always the same and looks like this:
    <link rel=”alternate” hreflang=”en-GB” href=”http://www.mysite.de/en/blog/”&gt;
    <link rel=”alternate” hreflang=”de-DE” href=”http://www.mysite.de/blog/”&gt;

    I think this causes double content so I would like to show the hreflang only on the frontpage of the blog and deactivate it on the following pages. Is this possible?

    Thank you in advance!

    Svensson36

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

    you should be able to do this with the following two filter functions:

    add_action( 'wp_loaded', function () {
    
    	if ( is_paged() ) {
    		add_filter( 'mlp_hreflang_html', '__return_empty_string' );
    		add_filter( 'mlp_hreflang_http_header', '__return_empty_string' );
    	}
    } );

    Just add these to your theme’s functions.php file, for example.

    Best regards,
    Thorsten

    P.S.: if you really like MultilingualPress, maybe you have two minutes for a quick review? 🙂

    Thread Starter Svensson36

    (@svensson36)

    Thank you for the quick answer!
    This is exactly what I need, thank you very much!

    You’re very welcome, and thanks for the review. 🙂

    Have a nice day.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘hreflang on paginated blog pages’ is closed to new replies.