Why would media_sideload_image() not work locally?

Ah, this is silly, but it turns out there was a very obvious reason why media_sideload_image() wasn’t working. My wp-content folder had the wrong the permissions from when I transferred it to my local environment and I wasn’t able to upload anything. Changed the permissions and it’s working fine.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)