Title: Remove Redirect
Last modified: August 22, 2016

---

# Remove Redirect

 *  Resolved [calvares](https://wordpress.org/support/users/redver/)
 * (@redver)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/remove-redirect-2/)
 * Hi there, how can i remove redirection after click on wishlist button?
 * [https://wordpress.org/plugins/yith-woocommerce-wishlist/](https://wordpress.org/plugins/yith-woocommerce-wishlist/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Support [Andrea Grillo](https://wordpress.org/support/users/agengineering/)
 * (@agengineering)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/remove-redirect-2/#post-5722913)
 * Hi,
 * there is no redirect after clicking on the button wishlist. When this happens?
 *  Thread Starter [calvares](https://wordpress.org/support/users/redver/)
 * (@redver)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-redirect-2/#post-5722933)
 * Hi, thanks for your reply.
 * I’m using cheope theme and I’m trying to implement it manualy.. so i create an
   icon with similar following link:
    [http://www.nnn.pt/wp-content/themes/cheope/theme/plugins/yith_wishlist/yith-wcwl-ajax.php?action=add_to_wishlist&add_to_wishlist=128099](http://www.nnn.pt/wp-content/themes/cheope/theme/plugins/yith_wishlist/yith-wcwl-ajax.php?action=add_to_wishlist&add_to_wishlist=128099)
 * And if i click it he redirects to product page.
 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-redirect-2/#post-5722934)
 * Hi calvares,
 * if you’re using wishlist 2.0 or higher, you can generate an url to wishlist page
   using the method get_wishlist_url() of class YITH_WCWL.
 * If you want your link to redirect to wishlist and, in the same time, to add a
   product to the wishlist, you can add to the url a query string like this: add_to_wishlist
   =<PRODUCT_ID>.
 * So, you can do something like this
 *     ```
       $url = add_query_arg( 'add_to_wishlist', $product->id, YITH_WCWL()->get_wishlist_url() );
       ```
   
 * Assuming $product is the correct instance of WC_Product
 * For older version of wishlist, you’ll have to manually create your add_to_wishlist
   function; you can try using this url:
 *     ```
       global $yith_wcwl;
       $url = add_query_arg( 'add_to_wishlist', $product->id, $yith_wcwl->get_wishlist_url() );
       ```
   
 * and adding this custom function to your function.php file
 *     ```
       if( ! function_exists( 'add_product_to_wishlist' ) ){
           function add_product_to_wishlist(){
               if( ! empty( $_GET['add_to_wishlist'] ) ){
                   global $yith_wcwl;
                   $yith_wcwl->add();
               }
           }
       }
       add_action( 'init', 'add_product_to_wishlist' );
       ```
   
 *  Thread Starter [calvares](https://wordpress.org/support/users/redver/)
 * (@redver)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-redirect-2/#post-5722935)
 * Hi,
    Thanks for your reply and the code that works very well 🙂 Now i only need
   to remove the redirection, for example, in product list page if i add one product
   to wishlist without how can i do without leaving this product list page, is it
   possible?
 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-redirect-2/#post-5722936)
 * Hi again 🙂
 * Try using this url:
 *     ```
       $url = add_query_arg( 'add_to_wishlist', $product->id );
       ```
   
 * This should add to wishlist, and redirect to the same page.
 * It would take a lot more work to get the same result asynchronously; in this 
   case you should use the shortcode [yith_wcwl_add_to_wishlist]
 *     ```
       echo do_shortcode( '[yith_wcwl_add_to_wishlist]' );
       ```
   
 * making sure that the global variable $product is correctly set, and customizing
   the template through the filters provided
 *  Thread Starter [calvares](https://wordpress.org/support/users/redver/)
 * (@redver)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/remove-redirect-2/#post-5722937)
 * Perfect 🙂
    Thanks for your time, five stars!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Remove Redirect’ is closed to new replies.

 * ![](https://ps.w.org/yith-woocommerce-wishlist/assets/icon-128x128.gif?rev=3129302)
 * [YITH WooCommerce Wishlist](https://wordpress.org/plugins/yith-woocommerce-wishlist/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yith-woocommerce-wishlist/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yith-woocommerce-wishlist/)
 * [Active Topics](https://wordpress.org/support/plugin/yith-woocommerce-wishlist/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yith-woocommerce-wishlist/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yith-woocommerce-wishlist/reviews/)

## Tags

 * [button](https://wordpress.org/support/topic-tag/button/)
 * [redirect](https://wordpress.org/support/topic-tag/redirect/)

 * 6 replies
 * 3 participants
 * Last reply from: [calvares](https://wordpress.org/support/users/redver/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/remove-redirect-2/#post-5722937)
 * Status: resolved