Export media with selected content
Export media with selected content
Description
When selecting one post type in the WordPress export screen, by default the linked media (attachments) are not included.
This plugin adds an “Export media with selected content” option. When checked, the plugin tries to find featured images and included media in the post_content, adding them to the export file.
Installation
- Upload the plugin files to the
/wp-content/plugins/export-media-with-contentdirectory, or install the plugin through the WordPress plugins screen directly. - Activate the plugin through the ‘Plugins’ screen in WordPress
Faq
This plugin hooks into the WordPress export routine and tries to find images related to the post (page, etc.). It does so by looking for “attached” (uploaded to) media and it searches the body of the post (the post_content) for image files.
It’s possible that themes or plugins use different ways of referencing media to your post. This plugin will not find those.
In eg. the Gutenberg gallery block, when you select an image size (for the gallery) the images with that size are ‘hard-coded’ in the html.
The WordPress import routine downloads the original image of the ‘export site’ and re-creates the configured image sizes. When your configured image sizes differ, you might end up with broken galleries.
So make sure both sites have the same image sizes configured. See the Media settings in both sites and check if themes or plugins use add_image_size() reference.
Yes! The plugin features two filter hooks:
* export_query
* export_query_media_ids
Please browse the code to see what they do, I guess export_query_media_ids is easiest to use as it requires you to just add more attachment IDs to an array.
Reviews
Works flawlessly
By davewilkinson on June 26, 2025
Does what it says on the tin, importing posts with featured images. Thanks!
Awesome Plugin
By mlabmedia on September 3, 2024
This plugin is great, I appreciate you!
Just works!
By Kori Ashton (koriashton) on April 6, 2024
Finally found the right plugin! This one actually exports the media and imports it correctly to your media library. Everything came over perfectly! Thank you for providing such an excellent plugin for us!
Works Great
By WillOfTheWeb on October 17, 2023
Wow awesome, it works great. I've been looking for something like this for some time now.
Just perfect plugin!
By Oleskii Kaliuzhnyi (AlexeyK) on July 25, 2023
Works exactly as expected! Happy to have this plugin, saved me a lot of time while migrating content.
Working
By rightpath1go on July 13, 2023
It works as I expected
Worked as expected
By antonyshajireplicon on April 20, 2023
exported and import media with custom fields working
As of Mar-2023 do not work with latest wordpress
By wholehope on March 6, 2023
It says does not test for the latest release. When I check the choice, the exported XML is larger. But import still fails when both websites are up.
Should be in core
By philhoyt on February 21, 2023
happy to have this plugin, this functionality should be in core.
Great plugin works on latest WP
By lguides1 on January 7, 2023
I have thousand of post page and if works like your dick!
Changelog
2.1.3
- prevent sql error when ID turns out to be NULL (props donnyoexman)
2.1.2
- Stupid debug error fix
2.1.1
- Added php 7.0 requirement to plugin header
- Replaced short array notation with full notation so plugin could work on lower php versions (untested)
2.1
- Performance: split queries & prepare attachments_map (props Albitos)
- Feature: support for shortcode
- Feature: support for Gutenberg Audio and Video blocks
- Tested with WordPress 5.6.2
2.0
- Feature: support for Gutenberg notation of images and gallery
- Feature: added
export_query_media_idsfilter - Tested with WordPress 5.2.3
1.1
- Tested with WordPress 5
- Includes “Uploaded to” media
1.0
- Bugfix when only posts from 1 category must be selected
- Feature: introduced
export_queryfilter to allow for hooking into this plugin
0.9.1
- Sanitize input
0.9
- Initial release
