• Hello,

    I want to create post through the following code outside the loop.
    it works fine but the video thumbnail is not generated.

    The following is my code :

    define( 'WP_USE_THEMES', FALSE );
    require_once('../wordpress/wp-load.php');
    
    if( $_POST['submit'] ) {
    
    	// Create post object
    	$post = array(
    	  'post_title'    => $_POST['post_title'],
    	  'post_content'  => $_POST['post_content'],
    	  'post_status'   => 'publish',
    	  'post_author'   => 1,
    	  'post_category' => array(3),
    	  'tags_input'    => $_POST['tags_input']
    	);
    
    	// Insert the post into the database
    	$post_id = wp_insert_post( $post );
    	update_post_meta( $post_id, 'cf_video_url', $_POST['cf_video_url'] );
    
    	get_video_thumbnail( $post_id );
    
    }

    https://www.ads-software.com/plugins/video-thumbnails/

  • The topic ‘Inserting post outside the loop does not generate Thumbnail’ is closed to new replies.