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
DELETE o FROM `wp_posts` o | |
LEFT OUTER JOIN `wp_posts` r | |
ON o.post_parent = r.ID | |
WHERE r.id IS null AND o.post_type = 'product_variation' |
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
<?php | |
//Source: http://www.adam-makes-websites.com/discoveries/fixing_messed_up_image_attachments_in_wordpress_that_have_no_postmeta_values | |
function fixWPImageMetaData() { | |
// Notes: | |
// 1) This function will not alter existing meta entries for your images. The function is to ADD meta data for the images | |
// without it due to manually importing them or some other kind of mess-up in your wordpress wp_postmeta table. | |
// 2) Always remember to take a full database backup before each run of the function! | |
// 3) Although only tested on fairly recent WP versions it may work as far back as v1.5+. Give it a go and let me know! |