Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi @rachitarora in order to remove the hreflang you need to add into your child theme or within a plugin the following snippet.

    
    add_filter('multilingualpress.hreflang_type', '__return_false');
    

    This will remove the following actions:

    – add_action( ‘template_redirect’, array( $hreflang, ‘http_header’ ), 11 );
    – add_action( ‘wp_head’, array( $hreflang, ‘wp_head’ ) );

    ps. Pay attention when you copy and paste the code above, may be the quotes changes on paste. So I suggest you to do it via FTP, in case something goes wrong you can always revert the changes.

    Let us know

    • This reply was modified 5 years, 9 months ago by Guido Scialfa.
    Thread Starter rachitarora

    (@rachitarora)

    Hi,
    I am trying to add the line add_filter('multilingualpress.hreflang_type', '__return_false'); in the functions.php of the child theme but I still see the <link rel="alternate" hreflang="en-US" href="https://www.niagaracruises.com/"><link rel="alternate" hreflang="fr-FR" href="https://www.niagaracruises.com/fr/"> tags in the <head>.
    Let me know if I am missing anything.
    Thank you.

    • This reply was modified 5 years, 9 months ago by rachitarora.
    • This reply was modified 5 years, 9 months ago by rachitarora.

    @rachitarora Do you have any cache active?

    Thread Starter rachitarora

    (@rachitarora)

    Hi @wido I dont have any cache active. If I make any other changes to the functions.php file of the child theme, I see them immediately though.
    Thanks.

    • This reply was modified 5 years, 9 months ago by rachitarora.

    @rachitarora Really wired, I tried multiple time and I see the filter applied correctly. Try to put it within a plugin, basically you just need a file under wp-content/plugins with an header https://developer.www.ads-software.com/plugins/plugin-basics/header-requirements/ and the add_filter in it.

    Thread Starter rachitarora

    (@rachitarora)

    @wido I tried adding this code instead to my functions.php file and that worked

    add_filter('multilingualpress.render_hreflang', function() { return false; });

    Looks like it was a version mismatch.
    Thank you

    • This reply was modified 5 years, 9 months ago by rachitarora.

    Hi @wido , @rachitarora.

    I tried all the filters you propose (‘multilingualpress.render_hreflang’ & ‘multilingualpress.hreflang_type’) but doesn’t work.

    Anyway the redirection is not working for my site.

    I have the same problem that @pawlmichael has here: https://www.ads-software.com/support/topic/redirection-not-working-26/
    I have changed the priorities in the Language Manager but the redirection is not working.

    I’d read all the posts concerning this issue but I haven’t found none with a solution.

    Which could be the cause of the issue?

    Please, let me know if you could help me.

    Many thanks,
    David.

    Hi @simpleswebs,

    Your problem is not related with the hreflang if your problem is the redirection.

    I would suggest you to open a different issue in order to keep the discussion here just for the hreflang.

    Btw could you check if the Redirect module of MLP is active?

    Hi @wido,

    Ok, I’ll open a new issue related with the redirection.

    Btw, the Redirect is active.

    Thanks,
    David.

    Hello,

    I have tried both of the filters. I have tried them both in functions.php and in a plugin file. Still the hreflang links appear.
    Any other ways to go?

    Plugin version is 2.11.3

    Thanks,
    Ian

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Remove hreflang tag from the page’ is closed to new replies.