Blocking multiple bookings for a reserved date is essential for managing reservations effectively. By implementing a robust booking system with real-time updates and clear user feedback, you can prevent overbooking. This will ensure a smooth experience for your customers.
To effectively manage reservations and prevent overbooking, WP Travel v9.1.0 introduces a new hook that allows you to block bookings for specific dates under various conditions.
Blocking All Trips for a Specific Date
To block all trips on a particular date, you can add the following code in the functions.php file of your child theme or simply you can add it through code snippets.
add_filter('wp_travel_enable_booking_reserve_date', function() {
return true;
});
Note: Please note that the above code will only work when the WP Travel Pro plugin is activated.
For example, if a customer books Trip A for December 25, then December 25 will be blocked for all other trips โ meaning no other trips can be booked on that same date.
For detailed information on creating a child theme, please refer to our KnowledgeBase.
You may find this useful: How To Add Exclude Dates For All The Trips?
Blocking Specific Trips for a Specific Date
If you need to block bookings for specific trips on a particular date, you can use the following code in the functions.php file of your child theme. You can also simply add it through code snippets.
add_filter('wp_travel_enable_booking_reserve_date', function() {
return true;
});
add_filter('wp_travel_enable_booking_reserve_date_all_trips', function() {
return false;
});
Note: Please note that the above code will only work when the WP Travel Pro plugin is activated.
For example, if Trip A is booked for December 25, then only Trip A will be unavailable for booking on that date โ while other trips will still be bookable.
Learn more: How to block booking before a specific date?
By implementing these snippets, you can block multiple bookings for a reserved date. This helps to efficiently manage your reservations and prevent multiple bookings on dates when trips are already reserved.
WP Travel Editorial is a team of WordPress and travel industry experts dedicated to delivering technical resources, travel business guides, and general travel insights. With over 10 years of experience, the team provides in-depth release notes, feature updates, and informative articles to help tour operators and travel enthusiasts succeed in the evolving travel landscape.
From plugin updates and industry trends to practical travel resources, WP Travel Editorial shares valuable content that supports both the travel industry and avid travelers.







I have 4 tours of different lengths and only one tour guide. If he is booked on one tour, none of the other tours should be available for booking on the days he is unavailable. Here is the Code Snippet that eventually worked (with help from Kimi AI):
php
/**
* ONE GUIDE โ block ALL trips on every day of every booking
* Return a numerically-indexed array so JS can use .forEach().
*/
add_filter( ‘wptravel_exclude_booking_dates’, function ( $excluded_dates ) {
/* 0) Make sure the date classes exist (safety) */
if ( ! class_exists( ‘DateTime’ ) ) {
return $excluded_dates;
}
/* 1) All confirmed bookings */
$bookings = get_posts( [
‘post_type’ => ‘itinerary-booking’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => -1,
‘fields’ => ‘ids’,
‘suppress_filters’ => false,
] );
$blocked = []; // add( new DateInterval( ‘P’ . ( $days – 1 ) . ‘D’ ) );
$period = new DatePeriod( $start, new DateInterval( ‘P1D’ ), $end->modify( ‘+1 day’ ) );
// 4) Push each day into the array
foreach ( $period as $date ) {
$blocked[] = $date->format( ‘m/d/Y’ );
}
}
return $blocked; // <– a plain array, not an associative array
} );
Thank you so much for sharing the custom code snippet to block all tour dates when using a shared resource like a single guide. Your solution is not only thoughtful but also highly practicalโaddressing a real-world scenario that many WP Travel users will benefit from.