cannot set media post id...

This commit is contained in:
Kiara Grouwstra 2022-02-09 21:34:51 +01:00
parent d78066b90a
commit d5b38ea3ed
1 changed files with 9 additions and 8 deletions

View File

@ -84,14 +84,15 @@ const migrate = async (node, resource) => {
console.error(`failed to create "${url}" due to error: ${e.message}`);
}
await Promise.all(mediaIds.map(async (mediaId) => {
if (mediaId) wp.media().id(mediaId).update({
post: id,
date_gmt: new Date(node.publishedAt)
});
})).catch((error) => {
console.error(error);
});
// what's up with setting media to posts? the below snippet yields 'invalid parameter(s): post'...
// await Promise.all(mediaIds.map(async (mediaId) => {
// if (mediaId) wp.media().id(mediaId).update({
// post: id,
// date_gmt: new Date(node.publishedAt)
// });
// })).catch((error) => {
// console.error(error);
// });
}
const download = async (location) => {