diff --git a/WordPress/Classes/Models/Blog+Post.swift b/WordPress/Classes/Models/Blog+Post.swift index 91eb5125280e..cafed1086f65 100644 --- a/WordPress/Classes/Models/Blog+Post.swift +++ b/WordPress/Classes/Models/Blog+Post.swift @@ -55,9 +55,14 @@ extension Blog { post.postFormat = settings?.defaultPostFormat post.postType = Post.typeDefaultIdentifier - if let userID = userID, let author = getAuthorWith(id: userID) { + if let userID, let author = getAuthorWith(id: userID) { post.authorID = author.userID post.author = author.displayName + } else { + /// Explicitly set the author ID to nil, otherwise it will default + /// to the Core Data value of 0 which is a logic error. + post.authorID = nil + post.author = nil } try? context.obtainPermanentIDs(for: [post])