unlink() doesn’t delete the uploaded file
I figured it out! the problem is the path is not right! Thanks to this post : Alow users to delete uploaded images inside backend? this function below helped : function url_to_path_test($url){ $url=str_replace(rtrim(get_site_url(),”https://wordpress.stackexchange.com/”).”https://wordpress.stackexchange.com/”, ABSPATH, $url); return $url; } So in my code if you change the remove previous image like this it will work : … Read more