Skip to content

Commit

Permalink
#463 featured image wasn't changed when attachment was saved
Browse files Browse the repository at this point in the history
  • Loading branch information
kylegilman committed Jan 19, 2023
1 parent f58844e commit c2b9421
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/admin/videopack-admin.php
Expand Up @@ -2807,7 +2807,10 @@ function kgvid_cron_check_post_parent_handler( $post_id ) {
$video_thumbnail_id = get_post_thumbnail_id( $post_id );
$post_thumbnail_id = get_post_thumbnail_id( $post->post_parent );

if ( ! empty( $post->post_parent ) && ! empty( $video_thumbnail_id ) && empty( $post_thumbnail_id ) ) {
if ( ! empty( $post->post_parent )
&& ! empty( $video_thumbnail_id )
&& empty( $post_thumbnail_id )
) {
set_post_thumbnail( $post->post_parent, $video_thumbnail_id );
}
}
Expand Down Expand Up @@ -3989,11 +3992,18 @@ function kgvid_save_post( $post_id ) {
) {
// render the post when it's saved in case there's a do_shortcode call in it so open graph metadata makes it into wp_head()
$response = wp_remote_get( get_permalink( $post_id ), array( 'blocking' => false ) );

}
}
add_action( 'save_post', 'kgvid_save_post' );

function kgvid_attachment_updated( $post_id ) {
$featured_id = get_post_meta( $post_id, '_kgflashmediaplayer-poster-id', true );
if ( ! empty( $featured_id ) ) {
set_post_thumbnail( $post_id, $featured_id );
}
}
add_action( 'attachment_updated', 'kgvid_attachment_updated' );

function kgvid_delete_transients() {

global $wpdb;
Expand Down

0 comments on commit c2b9421

Please sign in to comment.