• Resolved berserk77

    (@berserk77)


    Hello ,

    as mentioned in FAQs for adding a single external link as prefix in following code

    add_action( 'wpel_link', ( $link_object ) {
        if ( $link_object->is_external() ) {
            // get current url
            $url = $link_object->getAttribute( 'href' );
    
            // set redirect url
            $redirect_url = '//somedom.com?url='. urlencode( $url );
            $link_object->setAttribute( 'href', $redirect_url );
        }
    }, 10, 1 );

    Is it possible to rotate this prefix url //somedom.com?url= with 2-3 more urls in a simple order rotation ? How to do it ?

    For ex. we have 3 prefix urls :
    1] //somedom.com?url=
    2] https://example1.com/api=xxx&url=
    3] https://example2.com/api=xxx&url=

    We want to rotate these 3 in above code inplace of //somedom.com?url= in simple orderly manner whenever a page opened . Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Possible to rotate redirect_url prefix ?’ is closed to new replies.