Uploads don’t show, bool(false) changed empty string
-
New uploads don’t show on my site with the plugin enabled.
I tracked down the bug to your plugin:
runningreplace_host_name()
on the'upload_dir'
filter has the side effect as below.Before running the filter:
$uploads['error'] = bool(false)
After running the filter:
$uploads['error'] = string(0) ""
This is because
replace_host_name()
relies onstr_replace()
, which, when passed an array, apparently changes booleans to strings.This makes the
wp_get_attachment_url()
think there is an error, and reverts the attachment’s URL to the GUID. In my case those are the URLs from the staging server, which means some images don’t show up. (And those that do show are all from the staging server, which is incorrect anyway.)I’m not sure if this is a problem with the plugin being too aggresive, or it’s more a bug with
str_replace()
. I’ve googled it but didn’t find anything useful.I had to disable the plugin to make the site work.
- The topic ‘Uploads don’t show, bool(false) changed empty string’ is closed to new replies.