in case you guys still need this done, found something that can work:
1. Install the “Set Featured Image” plugin by By Frank Bültge
2. Via editor/cpanel, go to the file “/public_html/wp-content/plugins/memeone/memeone.php”.
3. Under section “// Function to create a WordPress post with a given meme as content”, look for this line of code:
$wp_post_id = wp_insert_post($new_wp_post);
and replace it with:
//add thumb
// $filename should be the path to a file in the upload directory.
$filename = ". $meme->meme_url$meme->meme_file_name.jpg";
// The ID of the post this attachment is for.
$parent_post_id = wp_insert_post($new_wp_post);
// Check the type of file. We'll use this as the 'post_mime_type'.
$filetype = wp_check_filetype( basename( $filename ), null );
// Get the path to the upload directory.
$wp_upload_dir = wp_upload_dir();
// Prepare an array of post data for the attachment.
$attachment = array(
'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ),
'post_mime_type' => $filetype['type'],
'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),
'post_content' => '',
'post_status' => 'inherit'
);
// Insert the attachment.
$attach_id = wp_insert_attachment( $attachment, $filename, $parent_post_id );
// Make sure that this file is included, as wp_generate_attachment_metadata() depends on it.
require_once( ABSPATH . 'wp-admin/includes/image.php' );
// Generate the metadata for the attachment, and update the database record.
$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
wp_update_attachment_metadata( $attach_id, $attach_data );
//end thumb
4. Save and you are done. Images should be set as featured upon publishing the post, not during the pending/draft process.
If you are using “Motivation Generator” By Stepan Stepasyuk, the steps are fairly similar:
1. Install the “Set Featured Image” plugin by By Frank Bültge
2. Via editor/cpanel, go to the file “/public_html/wp-content/plugins/motivation-generator/motivation-generator.php”.
3. Under section “// Function to create a WordPress post with a given poster as content”, look for this line of code:
$wp_post_id = wp_insert_post($new_wp_post);
and replace it with:
//add thumb
// $filename should be the path to a file in the upload directory.
//$filename = "' . $poster->poster_url . $poster->poster_file_name . '.jpg";
$filename = ". $poster->poster_url$poster->poster_file_name.jpg";
// The ID of the post this attachment is for.
$parent_post_id = wp_insert_post($new_wp_post);
// Check the type of file. We'll use this as the 'post_mime_type'.
$filetype = wp_check_filetype( basename( $filename ), null );
// Get the path to the upload directory.
$wp_upload_dir = wp_upload_dir();
// Prepare an array of post data for the attachment.
$attachment = array(
'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ),
'post_mime_type' => $filetype['type'],
'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),
'post_content' => '',
'post_status' => 'inherit'
);
// Insert the attachment.
$attach_id = wp_insert_attachment( $attachment, $filename, $parent_post_id );
// Make sure that this file is included, as wp_generate_attachment_metadata() depends on it.
require_once( ABSPATH . 'wp-admin/includes/image.php' );
// Generate the metadata for the attachment, and update the database record.
$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
wp_update_attachment_metadata( $attach_id, $attach_data );
//end thumb
4. Save and you are done. Images should be set as featured upon publishing the post, not during the pending/draft process. Good Luck