From e4c11cbcf65ddb2eface1da938470d96b01ea5c0 Mon Sep 17 00:00:00 2001 From: Ian Jenkins Date: Fri, 25 Jan 2019 11:34:20 +0000 Subject: [PATCH] Remove calls to get thumbnail post. When using this plugin with https://github.com/humanmade/network-media-library it doesn't work, it seems this is because it attempts to retrieve the post of the thumbnail (needlessly afaict) which won't work because the image exists on a different site in the network. Removing these calls seems to fix the issue and allows for a better mutli site experience. I'm not sure of any adverse affects of this, but let me know if you can see one. --- multi-post-thumbnails.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multi-post-thumbnails.php b/multi-post-thumbnails.php index cdbdf3c..7978d5e 100644 --- a/multi-post-thumbnails.php +++ b/multi-post-thumbnails.php @@ -408,7 +408,7 @@ private function post_thumbnail_html($thumbnail_id = null) { $set_thumbnail_link = sprintf( $format_string, sprintf( esc_attr__( "Set %s" , 'multiple-post-thumbnails' ), $this->label ), esc_url($image_library_url), $this->post_type, $this->id, $url_class, $this->label, $thumbnail_id ); $content = sprintf( $set_thumbnail_link, sprintf( esc_html__( "Set %s", 'multiple-post-thumbnails' ), $this->label ) ); - if ($thumbnail_id && get_post($thumbnail_id)) { + if ($thumbnail_id) { $old_content_width = $content_width; $content_width = 266; $attr = array( 'class' => 'mpt-thumbnail' ); @@ -453,7 +453,7 @@ public function set_thumbnail() { die($this->post_thumbnail_html(null)); } - if ($thumbnail_id && get_post($thumbnail_id)) { + if ($thumbnail_id) { $thumbnail_html = wp_get_attachment_image($thumbnail_id, 'thumbnail'); if (!empty($thumbnail_html)) { $this->set_meta($post_ID, $this->post_type, $this->id, $thumbnail_id);