Skip to content

Commit

Permalink
Merge pull request #14 from jarosz/master
Browse files Browse the repository at this point in the history
Add a check for post type
  • Loading branch information
zzxiang committed Feb 12, 2019
2 parents 3cb1fd3 + d5e83da commit f218d47
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion external-media-without-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ function init_emwi() {
add_filter( 'get_attached_file', function( $file, $attachment_id ) {
if ( empty( $file ) ) {
$post = get_post( $attachment_id );
return $post->guid;
if ( get_post_type( $post ) == 'attachment' ) {
return $post->guid;
}
}
return $file;
}, 10, 2 );
Expand Down

0 comments on commit f218d47

Please sign in to comment.