Support » Plugin: Polylang » x-default hreflang last element of attributes list

  • Resolved blackstar1991

    (@blackstar1991)


    Hi, I use this part of script in my function.php file that show x-default hreflang

    
    ////// x-default hreflang
    function polylang_add_xdefault( $hreflangs ) {
        $default = array(
            'x-default' => reset( $hreflangs ) // Fetch the first language URL in the list as x-default
        );
    
        return $hreflangs = $default + $hreflangs;
    }
    add_filter( 'pll_rel_hreflang_attributes', 'polylang_add_xdefault', 10, 1 );

    `
    and get x-default on a first position. Could you please say how to turn this attribute on a last position ever? *I read this manual, but didn’t find answer.

    The page I need help with: [log in to see the link]

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

    (@blackstar1991)

    I found answer

    
    
    ////// x-default hreflang
    function polylang_add_xdefault( $hreflangs ) {
        $default = array(
            'x-default' => reset( $hreflangs ) // Fetch the first language URL in the list as x-default
        );
    
        return $hreflangs = $hreflangs + $default;
    }
    add_filter( 'pll_rel_hreflang_attributes', 'polylang_add_xdefault', 10, 1 );

    We can close this question.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.