Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In this original post: Generate featured images old posts

This SQL is :

    INSERT into wp_postmeta (meta_value, meta_key, post_id) 
    SELECT DISTINCT(ID), post_type , post_parent 
    FROM wp_posts 
    WHERE post_type= 'attachment' 
    AND post_parent !=0 
    AND post_status='inherit';
    UPDATE wp_postmeta set meta_key = '_thumbnail_id' 
    WHERE meta_key='attachment'

This works great at setting the featured image by grabbing the first image attached in post, however, why is it re inserting the image in post also ? can it just set the featured image and NOT re intert in post ?

share|improve this question
    
What do you mean by "re inserting the image"? –  s_ha_dum Apr 8 '13 at 18:49
    
take a look here:magicelves.net/boxing/?p=9097. The first image(Zou-Shiming.jpg) was NOT there before running the sql...that is there was only the «second image» in the post....So the sql set the featured image and re inserted teh image in the actual post... –  user1656017 Apr 9 '13 at 16:36
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.