最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How do I fix broken links to images in imported posts' post_content?

programmeradmin2浏览0评论

I recently imported custom posts and their attached images from one WP site to another. Each image exists in the media library, but inside each post's content, the link to the image is /wp-content/uploads/[name_of_image]-[width]x[height].jpg i.e. /wp-content/uploads/tree.jpg is being referred to as /wp-content/uploads/tree-700x394.jpg but that particular size for the image does not exist.

If I click on the broken image inside the post editor, the thumbnail for the image populates inside the editor and I can choose one of the sizes for the image that exists. If I update the image and the post, it fixes the issue, but I don't want to do that for each post and I think it would be really useful to understand how to fix something like this more efficiently.

I am wondering if there is a plugin which can either generate each size of the images found in posts, i.e. make `tree-700x394' or that can go through and just change all of the images to their original size.

Edit: I saw Why won't these imported images show up? with the same problem and tried regenerating thumbnails but it did not work.

I recently imported custom posts and their attached images from one WP site to another. Each image exists in the media library, but inside each post's content, the link to the image is /wp-content/uploads/[name_of_image]-[width]x[height].jpg i.e. /wp-content/uploads/tree.jpg is being referred to as /wp-content/uploads/tree-700x394.jpg but that particular size for the image does not exist.

If I click on the broken image inside the post editor, the thumbnail for the image populates inside the editor and I can choose one of the sizes for the image that exists. If I update the image and the post, it fixes the issue, but I don't want to do that for each post and I think it would be really useful to understand how to fix something like this more efficiently.

I am wondering if there is a plugin which can either generate each size of the images found in posts, i.e. make `tree-700x394' or that can go through and just change all of the images to their original size.

Edit: I saw Why won't these imported images show up? with the same problem and tried regenerating thumbnails but it did not work.

Share Improve this question edited Jan 30, 2020 at 6:28 Sards asked Jan 30, 2020 at 4:14 SardsSards 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I added a new thumbnail to the site by inserting add_image_size('project', 700, 9999 ); into functions.php because it seemed like all of the images from old posts were set to 700 width and an automatic height. Then I installed and ran Regenerate Thumbnails and it fixed the issue.

发布评论

评论列表(0)

  1. 暂无评论