Appointments+ allows same time slot booking

My client just asked me a question about the Appointments+ plugin. It seems that, when entering appointments in the backend, they are able to double-book times.

  • Lindeni Mahlalela

    Hello Burlington Press

    I hope you are doing great today. Thank you for reporting this issue and thank you for your patience while we were looking into it.

    I have looked into the code of Appointments+ and confirmed with my colleagues that Appointments+ does not do any checks on the admin side, this may be a means of giving flexibility so that admins can do bookings without being restricted like in the front end. Yes, it is true that the actions performed by admins need to be checked to avoid any conflicts in bookings and other undesirable results.

    I have checked the code and found a hook that can be used to check the data before saving it. So I have prepared the following code that can be used to check if the time slot is booked or the service provider is not available at that time, then if all looks good then the booking will be saved otherwise an error message will be displayed:

    add_action( 'appointments_inline_edit', 'is_worker_booked', 10, 2 );
    public function is_worker_booked( $app_id, $data){
    	$worker_args = array(
    		'worker_id' => $data['worker'],
    	    'service_id' => $data['service']
    	    //,'location_id' => $location
    	$start	 = strtotime( $data['date'] . ' ' . $data['time']);
    	$service = appointments_get_service( $data['service'] );
    	$is_busy = apppointments_is_range_busy( $start, $start + ( $service->duration * 60 ), $worker_args );
    	if ( $is_busy ) {
    		$result = array(
    			'app_id' => $app_id,
    			'message' => '<strong style="color:red;">The service provider is not availble on the selected time slot.</strong>'
    		wp_send_json( $result );

    This code can be used by pasting it in your theme's functions.php or use it as an mu-plugin by creating a new file and paste the above code in it with the opening PHP tags like so:

    //paste the code above

    Then save the file and upload it to your website in 'wp-content/mu-plugins'. Alternatively, you can download the attached file and install it as a regular WordPress plugin or unzip/extract it and upload the .php file to:


    If you uploaded it as a regular plugin then you will have to activate the plugin "Disallow Duplicate Booking" in the plugins page, if you uploaded it to the mu-plugins folder then you don't need to do anything else it will start working right away.

    I have tested this on my test website and it works great. It does not only check if a specific time slot is booked for the same user but also checks if the service provider is available on the selected date and time. So if the admin is trying to book the service provider on a weekend and the provider does not work during the weekend then the booking will not allowed but instead an error message will be shown.

    I hope this works for you the way it works for me, please let us know if you need any further assistance with regards to this.

    Have a nice day.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.