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.
- 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
Images seem to be missing in the export file
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.
The images are imported into the new site but eg. my galleries are broken
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
Can I (have somebody) extend this plugin?
Yes! The plugin features two filter hooks:
Please browse the code to see what they do, I guess
export_query_media_idsis easiest to use as it requires you to just add more attachment IDs to an array.
Contributors & Developers
“Export media with selected content” is open source software. The following people have contributed to this plugin.Мүчөлөрү
Translate “Export media with selected content” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
- 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
- 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_queryfilter to allow for hooking into this plugin
- Sanitize input
- Initial release