Support » Plugin: WP Hotelier » Redirect To External Website NOT WORKING

  • Carl

    (@gravitycode)


    Hello how to use this function?
    I tried to use this function via my theme function.php using custom url seems nothing happen when i click the CHECK Availability and im using this code.

    function hotelier_custom_add_to_cart_from_room_list_redirect( $url ) {
        $checkin  = HTL()->session->get( 'checkin' );
        $checkout = HTL()->session->get( 'checkout' );
    
        $custom_url = add_query_arg( array(
    		'checkin'  => sanitize_text_field( $checkin ),
    		'checkout' => sanitize_text_field( $checkout ),
    	), 'http://example.com' );
    
        return $custom_url;
    } 
    add_filter( 'hotelier_add_to_cart_from_room_list_redirect', 'hotelier_custom_add_to_cart_from_room_list_redirect' );
    • This topic was modified 1 year, 9 months ago by Carl.
Viewing 1 replies (of 1 total)
  • Plugin Author benitolopez

    (@benitolopez)

    The function fires when you click on the reserve button, not on the “check availability” button. So when you book a room on the listing page and you click on the “Reserve” button.

    However, just seen that the redirect is not working. Because it uses the wp_safe_redirect() function so you need to sanitize the host also. I will change the redirect using wp_redirect() instead in the next update.

    Anyway, as I said this code has nothing to do with the datepicker URL. For the datepicker there is another filter, this: https://github.com/easy-wp-hotelier/wp-hotelier/blob/master/templates/global/datepicker.php#L19

Viewing 1 replies (of 1 total)
  • The topic ‘Redirect To External Website NOT WORKING’ is closed to new replies.