WordPress 4.4 appears to have a bug where images added through the editor in Visual Composer (TinyMCE?) are not URL-encoded. This cause errors on image paths with spaces when WP automatically generates the srcset attribute.

Eg:

Should be:

Due to plugin/theme incompatibilities I can’t upgrade to a newer version of WP (yet) but was wondering if anybody has run into this before and knows a fix. The fix has to happen in PHP when the page is saved because otherwise WordPress generates a srcset attribute which is also invalid, eg:

Spaces in srcset cannot be “safely” ignored by the browser like in src because spaces are a delimiter between URLs and sizes.

Read more here: Get WordPress to URL-Encode Image uploads


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: