| @@ -233,9 +233,9 @@ | ||
| 233 | 233 | // Upload to media library |
| 234 | 234 | $attachment_id = media_handle_sideload($file_array, $post_id); |
| 235 | 235 | |
| 236 | 236 | if (is_wp_error($attachment_id)) { |
| 237 | - @unlink($tmp); | |
| 237 | + @wp_delete_file($tmp); | |
| 238 | 238 | throw new Exception('Failed to upload image: ' . $attachment_id->get_error_message()); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | // Set title if provided |