/** * Called when a Resource is deleted. It deletes all the reservations of the the deleted Resource. * * @since 0.1.0 */ public function delete_resource_reservations($post_id) { $post = get_post($post_id); if ('resource' === $post->post_type) { $rb_db = new Resource_Booking_DB(); $rb_db->delete_resource($post_id); // postmeta rows are deleted automatically by wp } }