• Resolved yasuoohya

    (@yasuoohya)


    Are the following sample programs defective?

    
    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 );
    

    
    add_action( 'wpel_link', function( $link_object ) {
        if ( $link_object->is_external() ) {
            // get current url
            $url = $link_object->get_attr( 'href' );
    
            // set redirect url
            $redirect_url = '//somedom.com?url='. urlencode( $url );
            $link_object->set_attr( 'href', $redirect_url );
        }
    }, 10, 1 );
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Bugs?’ is closed to new replies.