Plugin Author
Marcel
(@marceljm)
Hi, @kraej
If it solves your issue, please consider to give this plugin a 5-star rating.
DELETE FROM yourSchema.yourTablePrefix_postmeta WHERE meta_id IN (
SELECT
meta_id
FROM
yourSchema.yourTablePrefix_postmeta m,
yourSchema.yourTablePrefix_posts p,
yourSchema.yourTablePrefix_term_relationships r,
yourSchema.yourTablePrefix_terms t
WHERE
m.post_id = p.id
and p.id = r.object_id
and r.term_taxonomy_id = t.term_id
and m.meta_key = ‘fifu_image_url’
and t.name = ‘XYZ’;
)
Thread Starter
kraej
(@kraej)
Hi @marceljm
Cheers! I got it working with a small change:
DELETE FROM yourSchema.yourTablePrefix_postmeta WHERE meta_id IN (SELECT * FROM (
SELECT
meta_id
FROM
yourSchema.yourTablePrefix_postmeta m,
yourSchema.yourTablePrefix_posts p,
yourSchema.yourTablePrefix_term_relationships r,
yourSchema.yourTablePrefix_terms t
WHERE
m.post_id = p.id
and p.id = r.object_id
and r.term_taxonomy_id = t.term_id
and m.meta_key = ‘fifu_image_url’
and t.name = ‘XYZ’;
) as t)
The DB entries are now deleted. However, I still see the external image assigned to the product. I am using Woocommerce. Could that be a reason (custom post type = product)? Anything I need to check here?
Thanks,
jochen
Plugin Author
Marcel
(@marceljm)
Try to do that, @kraej:
DELETE FROM postmeta
WHERE
meta_id IN (SELECT
m.meta_id
FROM
postmeta m
WHERE
m.meta_key = ‘_thumbnail_id’
AND m.meta_value = – 1)
Thread Starter
kraej
(@kraej)
Hej,
Thanks!
That actually removed some DB entries – still I can see the external featured image 🙁
best,
jochen
Plugin Author
Marcel
(@marceljm)
@kraej,
Once you have deleted the “fifu_image_url” meta key it’s not possible to get the image anymore.
So maybe are you using a wrong category (“XYZ”)? Because I think your delete isn’t working.
Or you should try to clean the cache (browser/database).
If it still doesn’t work, maybe you can provide me access to your database.