Skip to content

Commit 036e5f9

Browse files
committed
fix: fixed headers already sent
1 parent fddbb3a commit 036e5f9

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

plugins/wpgraphql-logging/src/Admin/View/List/List_Table.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function get_bulk_actions(): array {
122122
public function process_bulk_action(): void {
123123
$action = $this->current_action();
124124

125-
if ( ! in_array( $action, [ 'delete', 'bulk_delete', 'delete_all' ], true ) ) {
125+
if ( ! in_array( $action, [ 'delete', 'delete_all' ], true ) ) {
126126
return;
127127
}
128128

@@ -176,8 +176,19 @@ public function process_bulk_action(): void {
176176
$redirect_url
177177
);
178178

179-
wp_safe_redirect( esc_url_raw( $redirect_url ) );
180-
exit;
179+
if ( ! headers_sent() ) {
180+
wp_safe_redirect( esc_url_raw( $redirect_url ) );
181+
exit;
182+
} else {
183+
echo '<meta http-equiv="refresh" content="0;url=' . esc_url( $redirect_url ) . '">';
184+
printf(
185+
'<div class="notice notice-success"><p>%s <a href="%s">%s</a></p></div>',
186+
esc_html__( 'Logs deleted successfully.', 'wpgraphql-logging' ),
187+
esc_url( $redirect_url ),
188+
esc_html__( 'Return to Logs', 'wpgraphql-logging' )
189+
);
190+
exit;
191+
}
181192
}
182193
}
183194

0 commit comments

Comments
 (0)