Created
August 4, 2021 05:54
-
-
Save BramDriesen/7a3ef342fe12625efb278dfa3f630edc to your computer and use it in GitHub Desktop.
Remove all images with an hash (Wordpress)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT id, post_title | |
FROM wp_posts | |
WHERE post_type = 'attachment' | |
AND LENGTH(post_title) = 32 | |
AND post_title not like '%.%' | |
SELECT * | |
FROM wp_postmeta | |
WHERE post_id in ( | |
SELECT id | |
FROM wp_posts | |
WHERE post_type = 'attachment' | |
AND LENGTH(post_title) = 32 | |
AND post_title not like '%.%' | |
) | |
DELETE | |
FROM wp_postmeta | |
WHERE post_id in ( | |
SELECT id | |
FROM wp_posts | |
WHERE post_type = 'attachment' | |
AND LENGTH(post_title) = 32 | |
AND post_title not like '%.%' | |
) | |
DELETE | |
FROM wp_posts | |
WHERE post_type = 'attachment' | |
AND LENGTH(post_title) = 32 | |
AND post_title not like '%.%' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment