• I’m using the plugin Video Thumbnails to fetch thumbnails from a video url specified in a custom field.
    It works great in the bakend, but on my site the posts are submitted on the front end with this code:

    <?php
    
    if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] )) {
    
    	if (isset ($_POST['title'])) {
    		$title =  $_POST['title'];
    	} else {
    		echo 'Please enter a title';
    	}
    	if (isset ($_POST['description'])) {
    		$description = $_POST['description'];
    	} else {
    		echo 'Please enter the content';
    	}
    
    	$video_url = $_POST['videourl'];
    
    	$post = array(
    		'post_title'	=> $title,
    		'post_content'	=> $description,
    		'post_status'	=> 'publish',
    		'post_type'     => 'post',
    	);
    	$the_post_id = wp_insert_post($post);
    
    	update_post_meta( $the_post_id, '_videoembed', $video_url);
    
    	wp_redirect( home_url(dashboard) ); 
    
    }
    do_action('wp_insert_post', 'wp_insert_post'); 
    
    ?>

    How do I launch the functionality of the plugin after submitting the new post?
    So that the video thumbnail is fetched from its source and set as post_thumbnail…

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Video Thumbnails] fetching video thumbnails upon frontend post creation’ is closed to new replies.