diff --git a/packages/gatsby-source-wordpress/src/steps/source-nodes/fetch-nodes/fetch-nodes-paginated.js b/packages/gatsby-source-wordpress/src/steps/source-nodes/fetch-nodes/fetch-nodes-paginated.js index a604f2f31a9dd..14036885f1013 100644 --- a/packages/gatsby-source-wordpress/src/steps/source-nodes/fetch-nodes/fetch-nodes-paginated.js +++ b/packages/gatsby-source-wordpress/src/steps/source-nodes/fetch-nodes/fetch-nodes-paginated.js @@ -84,9 +84,11 @@ const paginatedWpNodeFetch = async ({ } let { - [contentTypePlural]: { nodes, pageInfo: { hasNextPage, endCursor } = {} }, + [contentTypePlural]: { nodes, pageInfo }, } = data + const { hasNextPage, endCursor } = pageInfo || {} + // Sometimes private posts return as null. // That causes problems for us so let's strip them out nodes = nodes.filter(Boolean)