ID ); //wp 3.3 fix global $post; $pagenum = isset( $_GET['pagenum'] ) ? intval( wp_unslash( $_GET['pagenum'] ) ) : 1; $action = isset( $_REQUEST['action'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) : ''; // delete post if ( $action == 'del' ) { $nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_key( wp_unslash( $_REQUEST['_wpnonce'] ) ) : ''; if ( isset( $nonce ) && !wp_verify_nonce( $nonce, 'wpuf_del' ) ) { return ; } //check, if the requested user is the post author $pid = isset( $_REQUEST['pid'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['pid'] ) ) : ''; $type = isset( $_REQUEST['section'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['section'] ) ) : ''; $maybe_delete = get_post( $pid ); if ( ( $maybe_delete->post_author == $userdata->ID ) || current_user_can( 'delete_others_pages' ) ) { wp_delete_post( $pid ); //redirect $redirect = add_query_arg( [ 'section' => $type, 'msg' => 'deleted'], get_permalink() ); wp_redirect( $redirect ); exit; } else { echo wp_kses_post( '