If you try to import a WordPress exports posts with attachments that’s is generated with any other filter than ‘all content’ attachments are lost.
This is not a big problem if you are dealing with small amounts of contents. But sometimes you need to import some of the contents from a very big WordPress site and you need to use filters based on post time, content type (post, page or any of the custom post types you use). In this kind of situation, WordPress standard export doesn’t work because as you filter, attachments are lost.
The need: a real case of wordpress export posts with attachments problem
During this week at DeMomentSomTres we have had to solve that situation. We where working on the new website of International School of Barcelona. The blog should be integrated into this web but it was hosted in another WordPress site in a diferent domain and hosting provider. This old blog had information since 2009 with a lot of attachments and images but we only needed last year. And to make it more difficult, there where many attachments and some of them very fat.
The only true solution we found was to create our own WordPress plugin to generate a custom export file that includes required attachments. Other options resulted in overload of the system and timeout errors either in export or import.
The need of the plugin was obvious so after having a look the WordPress repository of plugins and googling “WordPress export post with attachments” we decided to build it by our own.
Our WordPress export posts with attachments plugin
The plugin is based on WordPress Export API that is under documented but is quite short. So, the export file is a fully compliant WXR file.
After installing the plugin, WordPress standard post export procedure is modified in order to include attachments and images. The new export process includes in the resulting file only the required attachments and images.
As the plugin doesn’t modify any WordPress element as it uses hooks, it can be uninstalled without problems when you don’t need it.
This morning we have asked to include it on WordPress Plugins Repository but if you need to export post or custom post types with images or attachments you can download it from its specific page in our website.
Feel free to use it. We hope it is useful. What’s your opinion?
Credits: common content image from wikimedia
Latest posts by Marc Queralt i Bassa (see all)
- Release of DeMomentSomTres Export plugin 2.4 - 21 November, 2016
- Accommodation Plugin Updated - 13 January, 2015
- Bongo Checkout for Prestashop is now compatible with discount coupons - 12 November, 2014