I am creating an import from wordpress. The problem I have is that I want to set the publishing date the same as it was in wordpress. Is that possible?
You could just add your own wordpress publish date property
Well, I can, but it feels like there’s a bit of unnecessary logic for old records when sorting by date.
Storing the original date within your Document type would be the recommend approach which you can then use for display and sorting.
You cannot directly set PublishedDate because it’s managed internally by Umbraco, if i recall, however, you can set CreateDate and UpdateDate manually when creating the node via ContentService. Not sure if the below helps you get started:
var content = contentService.Create(“My Post”, parentId, “postDocType”);
content.CreateDate = wpPostDate; // WordPress publish date
content.UpdateDate = wpPostDate;
contentService.SaveAndPublish(content);
This will make the node appear as if it was created/updated at the WordPress date, even though the actual Umbraco “publish date” is still the system’s publish timestamp.