Remove part of the post_content with SQL

[ad_1]

Today in the morning, I wrote this post about random featured images: https://www.reddit.com/r/Wordpress/comments/1ffpbcw/comment/lmx3osf/?context=3.

Now, I found out where the images are coming from but I need to get rid of some parts of the post_content to make this stop.

To follow-up: I migrated a set of posts from website A and imported it to a website B. Some posts get imported with wrong featured images, some without featured. After some digging, I discovered that the posts that get imported with wrong featured images have a hidden id in post_content of that post.

For example, a post_content has the following image:

<img class="size-medium wp-image-315475 alignleft" src="URL HERE" alt="" width="300" height="200" />

I used the featured image generation plugin. What I expected the plugin to do, was to pull the URL of the image (files exist in the File Manager, but are not registered in database), and set it to be the Featured Image. Instead, the plugin takes the image of id, in the example, 315475 and sets this image instead. This leads to totally wrong images.

Now, I do not know PHP but I am super comfortable with SQL.

Is it possible to remove the following "wp-image-XYZXYZ" from the part of the post_content? SQL doesn't support REGEX, so I am feeling kind of stuck. I know though, that it's exactly this XYZXYZ id that keeps messing up with me.

All ideas are appreciated.

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer