Skip to content

Commit 1cada39

Browse files
committed
Fix redirect after bulk delete
Retain query parameters so that the user lands on the page it sent the form from.
1 parent 2c75f7b commit 1cada39

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/bootstrap.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -693,12 +693,21 @@ function action_handle_posts() {
693693
}
694694
}
695695

696-
$redirect = array(
697-
'page' => 'wp-crontrol',
698-
'crontrol_name' => $deleted,
699-
'crontrol_message' => MESSAGE_EVENT_DELETED_SELECTED,
696+
$redirect_url = wp_get_referer();
697+
698+
if ( ! $redirect_url ) {
699+
$redirect_url = admin_url( 'tools.php?page=wp-crontrol' );
700+
}
701+
702+
$redirect_url = remove_query_arg( array( 'crontrol_message', 'crontrol_name' ), $redirect_url );
703+
$redirect_url = add_query_arg(
704+
array(
705+
'crontrol_name' => $deleted,
706+
'crontrol_message' => MESSAGE_EVENT_DELETED_SELECTED,
707+
),
708+
$redirect_url
700709
);
701-
wp_safe_redirect( add_query_arg( $redirect, admin_url( 'tools.php' ) ) );
710+
wp_safe_redirect( $redirect_url );
702711
exit;
703712

704713
} elseif ( isset( $_GET['crontrol_action'] ) && 'delete-cron' === $_GET['crontrol_action'] ) {

0 commit comments

Comments
 (0)