Skip to content

Commit

Permalink
Merge pull request #310 from 10up/fix/featured-image-delete
Browse files Browse the repository at this point in the history
Fix featured image delete push issue
  • Loading branch information
peterwilsoncc authored Sep 14, 2023
2 parents 4ed49d5 + 0387c94 commit 726a7e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions includes/classes/API/SubscriptionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ public function receive_item( $request ) {

if ( ! empty( $request['post_data']['distributor_media'] ) ) {
\Distributor\Utils\set_media( $request['post_id'], $request['post_data']['distributor_media'] );
} else {
// Remove any previously set featured image.
delete_post_meta( (int) $request['post_id'], '_thumbnail_id' );
}

/**
Expand Down
3 changes: 3 additions & 0 deletions includes/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ function process_distributor_attributes( $post, $request, $update ) {

if ( isset( $request['distributor_media'] ) ) {
\Distributor\Utils\set_media( $post->ID, $request['distributor_media'] );
} else {
// Remove any previously set featured image.
delete_post_meta( $post->ID, '_thumbnail_id' );
}

/**
Expand Down

0 comments on commit 726a7e1

Please sign in to comment.