Post modification dates not imported
-
I have exported posts from a self-hosted site and have imported them into a new site hosted by WordPress.com. The import was successful, but I noticed the modification dates of my posts weren’t right. It appears they were all set to the post date.
The discrepancy can be checked easily using the wp-json REST API. On the left is from WordPress.com’s API, and the right is my self-hosted site. Look at the modified dates.
I have checked the XML file and the modified timestamps are there, and are correct. I think there is a bug in the import tool causing the post modification dates to be set to the post date. Can you have your developers check this?
-
Hi there,
Looking at our code for the importer it appears we rewrite the
post_modifieddate intentionally during import.That date/time isn’t used anywhere in WordPress.com, and we don’t display the Last Modified date for posts in the posts list WordPress.com, the way it displays in the open source version of WordPress.
Can you tell me where/how you spotted the dates weren’t right? It would also help to know how you’re using this data – as this is being done intentionally any change would be considered an enhancement, and it helps to be be able to give a use-case as motivation for the enhancement when requesting a change like this.
-
Hi, thank you for the confirmation!
You are correct it’s generally not used, but it is used in the API:
https://public-api.wordpress.com/wp/v2/sites/<site>/postsThe image in my first post shows a post as seen through this API.
I basically use the API to display the content in a different way, and I use the modified date as metadata in the HTML for Open Graph to aid search engines and also sitemap.xml’s modification dates.
Is there a workaround to fix the dates for the time being?
-
Thanks for explaining!
Would you mind sharing the URLs of the sites you moved from/to just so we can also have a visual reference?
-
The WordPress site is here: https://eatonworksposts.wordpress.com/
The real site is here: https://eaton-works.com/ -
Thank you. We’re checking in with the imports team, and we’ll let you know what we find.
-
Great. I would appreciate it if you would respect all the timestamp fields when importing posts. Let me know what you determine.
In the meantime, let me know if there is anything I can to to update the timestamps myself. My current plan does not allow for direct database changes.
-
Okay, looks like I was mistaken and our import team considers this to be a bug, so we’ve opened a bug report.
I can’t give you a timeline on a fix, but we’ll try to update you here once it’s done.
Thanks for reporting this!
-
-
Hi, do you have any updates on the bug report? This is a blocking issue for me and I can’t import anything until this is resolved.
-
Hi! The issue is filed and they’re aware of it, but they do have other projects they were working on when this was reported.
Curiously, since you’ve got a .org installation, if you create a fresh installation and import using the default, do the last updated dates persist there?
-
I’ve confirmed that it’d be a while. Let’s see if there’s an alternative. Let us know what you find with the regular .org importer on another .org site.
-
Hi, I’m not sure I understand. I want to import data to my .org site that was exported from a self-hosted site. Are you suggesting there is an alternative import method that would not have this problem?
-
Hi @eatonz,
My colleague @supernovia was looking to see if you can reproduce the issue if you were to import into a fresh WordPress.org install to rule out any other peculiarities.
Could you please give that a try, and let me know if it imports properly on a tes WordPress.org site?
-
staff-sheva I am importing into a fresh .org site though. There’s nothing there, and before each import attempt I deleted all posts to ensure only the new data will be there after the import.
-
Could you please clarify what you mean? Are you suggesting that posts are not being imported, or that the Last Modified date isn’t present?
-
All posts are imported successfully, but the modified date ends up being the post/creation date, which is the bug. The import needs to respect the existing modified date instead of changing it.
-
What @supernovia was trying to see is that if you tried to import your file to another new self-hosted site if the modified by date persists on the import.
The WordPress importer here at WordPress.com is based on the one in the WordPress software but is modified to fit our hosting infrastructure.
If it works in the core WordPress software, there might be something we could do to import your content, but we won’t know if that will work unless you can test it on your end.
In your hosting panel, you should be able to create a new subdomain of your current domain (something like
test.eaton-works.com) and install WordPress to that subdomain, import your XML file, and check to see if the “modify” date information is also there after import.Once you can test that you can remove the WordPress install from that subdomain and delete the subdomain all without affecting your current site.
The problem with our importer not retaining the modified date will likely not be worked on anytime in the near future, so we want to try and help where we can.
I hope that clarifies things.
-
helper-heroponriki Oh, I see. I’d imagine it would retain the dates, as they are there in the XML.
However, as an easier solution for this problem right now, I have an idea. If I gave you the post ID #s and dates, would you be able to manually update them in the
wp_poststable? It would only involve updating thepost_modifiedandpost_modified_gmtcolumns.There’s only 12 posts so it wouldn’t take long. Let me know if you would be able to do this for me.
-
That’s probable, but we don’t allow that level of database access here, and we don’t directly modify databases (even on request), so it’s not possible.
- The topic ‘Post modification dates not imported’ is closed to new replies.