Create a new post using rest api and save featured image using an external image url

Instead of using wp_ajax_ (i.e. admin-ajax.php), how about adding a custom REST API field and then using its update_callback, download the remote image and set it as the post featured image? Working Example add_action( ‘rest_api_init’, ‘wpse_381217’ ); function wpse_381217() { register_rest_field( ‘post’, ‘featured_image_url’, array( // If you don’t want to expose the field in the … Read more

Automatically assign video ‘poster’ value to ‘filename’ for archive listing

Thanks for your help. Managed to figure out a temporary solution, should anyone else have a similar query. Temporarily edited media.php $filename = basename( wp_get_attachment_url( $attachment_id ) ); $default_types = wp_get_video_extensions(); $defaults_atts = array( ‘src’ => ”, ‘poster’ => “diary/wp-content/Pictures/posters/”.$filename.”.jpg'”, ‘loop’ => ”, ‘autoplay’ => ”, ‘preload’ => ‘none’, ‘width’ => 640, ‘height’ => 360, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)