From a58376c17742d41389c158ba9f7440c20c309da1 Mon Sep 17 00:00:00 2001 From: Ante Laca Date: Tue, 2 Apr 2024 16:58:59 +0200 Subject: [PATCH] Fix: WP edit bulk action (#7310) Co-authored-by: Ante Laca --- src/FormBuilder/Routes/EditFormRoute.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/FormBuilder/Routes/EditFormRoute.php b/src/FormBuilder/Routes/EditFormRoute.php index a72aaff071..865487da65 100644 --- a/src/FormBuilder/Routes/EditFormRoute.php +++ b/src/FormBuilder/Routes/EditFormRoute.php @@ -19,10 +19,14 @@ class EditFormRoute public function __invoke() { if (isset($_GET['post'], $_GET['action']) && 'edit' === $_GET['action']) { - $post = get_post(abs($_GET['post'])); - if ('give_forms' === $post->post_type && Utils::isV3Form($post->ID)) { - wp_redirect(FormBuilderRouteBuilder::makeEditFormRoute($post->ID)); - exit(); + // This conditional will be also triggered by WP edit bulk action + // WP sends an array of IDs so if that is the case here, we can skip this + if ( ! is_array($_GET['post'])) { + $post = get_post(abs($_GET['post'])); + if ('give_forms' === $post->post_type && Utils::isV3Form($post->ID)) { + wp_redirect(FormBuilderRouteBuilder::makeEditFormRoute($post->ID)); + exit(); + } } } }