Skip to content

Commit 063ea0e

Browse files
committed
Sanitize question_id when processing bulk delete action
1 parent 1e26180 commit 063ea0e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

includes/admin/class-wp-job-manager-screening-questions-list-table-form-handler.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,17 @@ public function process_bulk_action() {
142142
}
143143

144144
$page_url = admin_url( 'admin.php?page=wp-job-manager-screening-questions' );
145-
$delete_ids = $_POST['question_id'];
145+
$delete_ids = isset( $_POST['question_id'] ) ? $_POST['question_id'] : array( );
146146

147-
if ( count( $delete_ids ) ) {
148-
foreach ( $delete_ids as $id ) {
149-
$question_id = intval( $id );
147+
if ( ! $delete_ids ) {
148+
return;
149+
}
150+
151+
foreach ( $delete_ids as $id ) {
152+
$question_id = intval( $id );
150153

151-
if ( $question_id > 0 ) {
152-
wpjmsq_delete_question( $question_id );
153-
}
154+
if ( $question_id > 0 ) {
155+
wpjmsq_delete_question( $question_id );
154156
}
155157
}
156158

0 commit comments

Comments
 (0)