Featured Images not appearing

All your issues could be solved with some MySQL queries.

Regarding point #1: if you are using mod_rewrite then I recommend using absolute URLs for images in posts, if you are displaying full post content (including its images) on other pages – as you suggest.

You can do a MySQL search/replace as follows:

UPDATE wp_posts SET post_content = replace(post_content, 'old string', 'new string');

So, for example, if all your images are located in the folder wp-content/uploads (that’s where WordPress usually places the media), then your search/replace could be something like:

UPDATE wp_posts SET post_content = replace(post_content, 'src="https://wordpress.stackexchange.com/questions/83310/uploads/", 'src="http://www.example.com/uploads/');

Regarding point #2:

You’re going to need to grab the ID of the image from wp_posts table, in order to add it to the wp_postsmeta table.

Let’s say you have in wp_postsmeta some meta data for post_id 1. One of these is ‘featured image’, so the row would be something like:

post_id = 1;
meta_key = 'featured_image';
meta_value="uploads/2012/12/someimage.jpg";

to get the ID of that image, you’d do:

SELECT ID FROM wp_posts WHERE guid LIKE '%uploads/2012/12/someimage.jpg';

You’d then be able to insert to wp_postsmeta the data as:

INSERT INTO wp_postsmeta (post_id, meta_key, meta_value) VALUES (1, '_thumbnail_id', ID-OF-IMAGE);

So, to combine it all, use a simple php script as follows:

    $posts = $wpdb->get_results("SELECT post_id, meta_value FROM wp_postmeta WHERE meta_key='featured_image'", ARRAY_N);
    if ($posts) {
        while ($posts as $post) {
            $image = $wpdb->get_row("SELECT ID FROM wp_posts WHERE guid LIKE '%" . $post[1] . "%'", ARRAY_N);
            if ($image_id) {
                $wpdb->query("INSERT INTO wp_postsmeta (post_id, meta_key, meta_value) 
                  VALUES ($post[0], '_thumbnail_id', '" . $image[0] . "')");
            }
        }
    }

Hope all of this gives you some direction and assistance. I’ve written it in broad terms, so please remember to back up your db before doing any changes!

Good luck.

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedusedueduseduedusedusedueduedu