Export media with selected content


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.


  • "Export media with selected content" checkbox option now available in the Export screen.


  1. Upload the plugin files to the /wp-content/plugins/export-media-with-content directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress


It does not seem to work?

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.

Can I (have somebody) extend this plugin?

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.


September 5, 2021
This should be built in to WordPress. Saved my ass.
August 27, 2021
This totally didn't work at all... I need to export all blog posts with images, and it only exported the .xml, which wordpress can do without this plugin. And in the media library, this particular website theme and wordpress version DOES have/show next to each image asset "uploaded to" and the page it's associated with, but still nothing happened when I used this plugin to export except generate the .xml file. Disapointing.
August 26, 2021
Why the built-in export tool, not includes media when exporting selected posts, is a mystery to me. Sometimes I just want to move a post from one site to another, *including* whatever imagery I've used. Export media with selected content - exported a semi-advanced post which included several galleries, a video including its poster, and of course a featured image. Everything went smoothly. I'm using the Gutenberg Block editor only. I wouldn't expect this plugin to work with proprietary page builders like Divi or Oxygen. They, however, features their own export/import tools you can use. Thank you so much for filling out that strange core export feature gap 🙂 Bjarne
Read all 58 reviews

Contributors & Developers

“Export media with selected content” is open source software. The following people have contributed to this plugin.




  • prevent sql error when ID turns out to be NULL (props donnyoexman)


  • Stupid debug error fix


  • Added php 7.0 requirement to plugin header
  • Replaced short array notation with full notation so plugin could work on lower php versions (untested)


  • Performance: split queries & prepare attachments_map (props Albitos)
  • Feature: support for [playlist] shortcode
  • Feature: support for Gutenberg Audio and Video blocks
  • Tested with WordPress 5.6.2


  • Feature: support for Gutenberg notation of images and gallery
  • Feature: added export_query_media_ids filter
  • Tested with WordPress 5.2.3


  • Tested with WordPress 5
  • Includes “Uploaded to” media


  • Bugfix when only posts from 1 category must be selected
  • Feature: introduced export_query filter to allow for hooking into this plugin


  • Sanitize input


  • Initial release