1

I’m having an issue with an older site that I’m moving to the new server.

There was no way to import attachments so I had to /uploads/ to new server via FTP. Then I’ve imported images with wp cli’s wp media import and they successfully showing in the media library. They are not attached to the respective posts though.

My problem is I can’t make them work responsively. By this I mean srcset and sizes aren’t showing in the posts, but work fine on attachment pages.

I’ve tried to regenerate thumbnails and force regenerate thumbnails with no luck.

THe markup is following (this is what I got from the older site):

<a href="http://example.com/wp-content/uploads/2016/07/filename.jpg"> <img class="alignleft size-full wp-image-6252" src="http://example.com/wp-content/uploads/2016/07/filename.jpg"> </a>

Even if I attach images to post from the media library it doesn’t work. Only inserting via editor seems to generate srcset correctly.

Not sure how to proceed, because inserting 3000 images by hand seems not real.

2
  • How is the template building the <img> tag? You have to use the proper wordpress functions to get a responsive image.
    – ngearing
    Dec 14, 2017 at 22:36
  • It is used in the_content so I'm assuming it should be added via the filter.
    – Runnick
    Dec 14, 2017 at 22:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.