﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	focuses
44303	`media_handle_sideload()` may unexpectedly return 0 on error	jirihon	joemcgill	"This is closely related to #41726. The documentation of `media_handle_sideload()` (same as for `media_handle_upload()`) states that it will always return the attachment ID on success, or a `WP_Error` object on failure. However, it currently may return 0 as well if something fails with the attachment post insertion. That is because `wp_insert_attachment()` and `wp_insert_post()` do not return `WP_Error` objects by default, and `media_handle_sideload()` for some reason does not change this like it should.

This requires a simple fix: call `wp_insert_attachment()` with the fourth parameter set to true as it was recently fixed for the `media_handle_upload()` in #41726."	defect (bug)	closed	normal	5.1	Media		normal	fixed	has-patch commit		
