I am moving a site that I manage from a custom CMS to Wordpress and am finding that some of the attributes on image tags to be problematic on display once in the WP environment. To fix this, I need to strip out the height attribute that is inlined into each image tag in the post_content
column of the wp_posts
table.
Starting with the original value in the DB, I want the following:
<img src="http://example.com/img/20150823_image.jpg" style="width: 730px; height: 730px;" />
To become:
<img src="http://example.com/img/20150823_image.jpg" style="width: 730px;" />
So, essentially, I need to trim out the " height: 730px;" portion. It is image-specific, so in this case it is 730 but in another it could be 1500, 447, 80, etc.
I was trying to see if I could use a '%' as a wildcard but that doesn't seem to be working...
UPDATE wp_posts SET post_content = REPLACE(post_content,' height: %px;','');
Any help would be greatly appreciated as I'd rather not have to manually go through thousands of rows stripping these out.