diff --git a/src/Field/Image.php b/src/Field/Image.php index f26b4fc..7d06ae2 100644 --- a/src/Field/Image.php +++ b/src/Field/Image.php @@ -133,7 +133,8 @@ protected function fillThumbnailFields(array $data) */ protected function fetchMetadataValue(Post $attachment) { - $meta = PostMeta::where('post_id', $attachment->ID) + $connection = $this->post->getConnectionName(); + $meta = PostMeta::on($connection)->where('post_id', $attachment->ID) ->where('meta_key', '_wp_attachment_metadata') ->first(); @@ -149,8 +150,10 @@ protected function fetchMultipleMetadataValues(Collection $attachments) { $ids = $attachments->pluck('ID')->toArray(); $metadataValues = []; + + $connection = $this->post->getConnectionName(); - $metaRows = PostMeta::whereIn("post_id", $ids) + $metaRows = PostMeta::on($connection)->whereIn("post_id", $ids) ->where('meta_key', '_wp_attachment_metadata') ->get();