Skip to content

Commit

Permalink
Fix: WP edit bulk action (#7310)
Browse files Browse the repository at this point in the history
Co-authored-by: Ante Laca <[email protected]>
  • Loading branch information
alaca and Ante Laca authored Apr 2, 2024
1 parent 4174ebf commit a58376c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/FormBuilder/Routes/EditFormRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
}
Expand Down

0 comments on commit a58376c

Please sign in to comment.