• Resolved amandau

    (@amandau)


    Hi!

    I want to change or disable the line:
    <link rel="alternate" href="https://example.com/" hreflang="x-default" />
    Ideally x-default should be the language you are currently visiting, for example
    href="https://example.com/en/"

    If this can’t be done I would rather disable the x-default line all together.

    I understand that it’s possible to remove x-default by enabling “Hide URL language information for default language”, but I would rather not do that as it would change the url structure in a big way.

    Could anyone help me along the way with how a filter for this would look like? I appreciate any help I can get, thanks.

Viewing 1 replies (of 1 total)
  • Thread Starter amandau

    (@amandau)

    I got the answer on how to disable x-default entirely from Polylang email support:

    add_filter( 'pll_rel_hreflang_attributes', 'removexdefault' );
    function removexdefault( $hreflangs ) {
    unset( $hreflangs['x-default'] );
    return $hreflangs;
    }

    Thanks!

Viewing 1 replies (of 1 total)

The topic ‘Changing or disabling x-default’ is closed to new replies.