Created
January 22, 2024 21:51
-
-
Save TimBHowe/65220ebcbd9c1ce480f2d7945af2c920 to your computer and use it in GitHub Desktop.
Run a query to fine all WooCommerce products feature image and product gallery image IDs. Any that return Null are missing.
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 wp_posts.ID, wp_postmeta.meta_value AS sku, wp_posts.post_title AS title, wp_postmeta2.meta_value AS image, wp_postmeta3.meta_value AS gallery FROM wp_posts | |
LEFT JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '_sku' ) | |
LEFT JOIN wp_postmeta AS wp_postmeta2 ON (wp_posts.ID = wp_postmeta2.post_id AND wp_postmeta2.meta_key = '_thumbnail_id' ) | |
LEFT JOIN wp_postmeta AS wp_postmeta3 ON (wp_posts.ID = wp_postmeta3.post_id AND wp_postmeta3.meta_key = '_product_image_gallery' ) | |
WHERE wp_posts.post_type = 'product' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment