mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-07-18 22:23:41 +09:00
Merge pull request #4 from superted17/master
Adds undefined safety check to getPostCoverImageId
This commit is contained in:
@@ -199,6 +199,7 @@ function getPostId(post) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getPostCoverImageId(post) {
|
function getPostCoverImageId(post) {
|
||||||
|
if (post.postmeta === undefined) return;
|
||||||
let postmeta = post.postmeta.find(postmeta => postmeta.meta_key[0] === '_thumbnail_id');
|
let postmeta = post.postmeta.find(postmeta => postmeta.meta_key[0] === '_thumbnail_id');
|
||||||
let id = postmeta ? postmeta.meta_value[0] : undefined;
|
let id = postmeta ? postmeta.meta_value[0] : undefined;
|
||||||
return id;
|
return id;
|
||||||
|
|||||||
Reference in New Issue
Block a user