• Resolved maximmmus

    (@maximmmus)


    Hello,

    I have added the code below to the functions file to create a redirect. The problem is that it converts http:// to http%3A%2F%2F and the redirect fails. Do you have a fix for this? Thanks

    add_action( 'wpel_link', function ( $link ) {
        // check if link is an external links
        if ( $link->is_external() ) {
            // get current url
            $url = $link->get_attr( 'href' );
    
            // set redirect url
            $redirect_url = '//somedom.com?url='. urlencode( $url );
            $link->set_attr( 'href', $redirect_url );
        }
    }, 10, 1 );
    • This topic was modified 7 years, 4 months ago by maximmmus.

The topic ‘http:// becomes http’ is closed to new replies.