Support » Plugin: Attachments » Data Migration and Custom Post Types oddity and comments

  • First off, I’ve got it all worked out, but there might need to be some better error checking in the migration process.

    What happened:

    I went to make changes to a site that had not been updated in a while, and saw the Attachments update. As the host does regular backups, I threw caution to the wind and proceeded, migrated the data and implemented the new code.

    I had been using Attachments on regular Pages and on a custom post type called Articles. The Pages one, for the most part went fine, but I ran into a problem with the Articles one. First, it wasn’t clear about setting up a separate instance for Custom Post Types, though I figured that out.

    Secondly, the migration process seemed to delete the content from the first four of my Articles out of a total of 53. Luckily there were autosaved revisions that I was able to restore from that were current enough.

    I’m not 100% certain the missing content was Attachments fault, but I don’t have another explanation, so it might be worth a look.

    A couple other point/questions:

    Loop oddity. I have a loop with an Attachments

    I’m getting a WYSIWYG toolbar in the caption field. Is there a way to turn that off? Might be related to the loop issue?

    Finally, the whole Attachments interface is even less compact than before, which makes re-ordering difficult. It’d be nice to have a way to easily collapse all the Attachment items down to their titles only or some other interface for re-ordering.


Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jonathan Christopher


    What is it you feel wasn’t clear about setting up a separate instance? Both the Plugin Directory instructions and the GitHub instructions (as well as the documentation on the Settings screen within the plugin itself that’s called out with both a banner and a pointer upon activation if old data is found) explain that pretty plainly.

    The migration process does not delete data. Please feel free to take a look through the migration code but it absolutely has not and never will delete data. The only way to delete Attachments data is to physically click the link on an edit screen. It’s possible that the migration itself didn’t go as planned and some wacky character encoding issue prevented a conversion, but the data will never be deleted.

    As your code snippet seems to have broken the formatting of the rest of your message I’m guessing your focus was around the formatting of the content. If you took a look at the code you were setting up for your custom instance you’ll notice that you implemented the WYSIWYG editor when you copied and pasted the snippet. WordPress implements something called autop and other formatting filters on WYSIWYG content. You can change that to be a textarea and that formatting will go away.

    Please take some time to review all of the documentation that ships with the plugin, it should not only help with the upgrade of this plugin but other plugins as well that ship a version upgrade.

    Thanks for the feedback on the UI, I’ll add it to the list.

    I don’t recall the plugin addressing the Custom Post Type issue, but I was able to find the info in the documentation as I’d mentioned. My point was that that could have been a little more up front in the process — the custom post type part. That’s all. If it was there, I guess I missed it.

    Glad to know the migration process does not delete data. It’s a mystery then. I suspect it might have been the WordPress update I did at the same time then, which is odd too.

    I left the default instance in there, which is the one with the WYSIWYG. I noticed

    Is is safe to just re-create an instance for to replace the default using the same name?

    I’m assuming I need to also include the code that disable the default.


    Plugin Author Jonathan Christopher


    Yes, you can recreate a custom instance using the same name (that way you’ll still use the previously-migrated data). You can actually leave the default enabled, using the same instance name (attachments) will overwrite the default instance.

    Great. Thanks!

    The topic is over a month old, but still – in case when normal tools will fail, you still have the LordUI automatization software, that may transfer your data.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Data Migration and Custom Post Types oddity and comments’ is closed to new replies.