Title: Bugs?
Last modified: December 6, 2019

---

# Bugs?

 *  Resolved [yasuoohya](https://wordpress.org/support/users/yasuoohya/)
 * (@yasuoohya)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/bugs-97/)
 * 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)

 *  Plugin Author [WebFactory](https://wordpress.org/support/users/webfactory/)
 * (@webfactory)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/bugs-97/#post-12211395)
 * What exactly in that code do you think is problematic?

Viewing 1 replies (of 1 total)

The topic ‘Bugs?’ is closed to new replies.

 * ![](https://ps.w.org/wp-external-links/assets/icon-256x256.png?rev=2103983)
 * [External Links - nofollow, noopener & new window](https://wordpress.org/plugins/wp-external-links/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-external-links/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-external-links/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-external-links/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-external-links/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-external-links/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [WebFactory](https://wordpress.org/support/users/webfactory/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/bugs-97/#post-12211395)
 * Status: resolved