diff --git a/includes/class-batch.php b/includes/class-batch.php index 0d9ace2..09b5474 100644 --- a/includes/class-batch.php +++ b/includes/class-batch.php @@ -186,7 +186,7 @@ public function get_items_count() { public function get_percentage() { $total_items = $this->get_items_count(); $total_processed = $this->get_processed_count(); - $percentage = 100 - ( ( ( $total_items - $total_processed ) / $total_items ) * 100 ); + $percentage = ( ! empty( $total_items ) ) ? 100 - ( ( ( $total_items - $total_processed ) / $total_items ) * 100 ) : 0; return number_format( (float) $percentage, 2, '.', '' ); } @@ -206,4 +206,4 @@ public function restart() { delete_option( $this->get_db_identifier() ); } -} \ No newline at end of file +}