This code will add "Media" to WP All Export and WP All Import's drop-down options when choosing a post type to export/import. This allows you to directly edit specific fields for media library items, but it does not allow you to import new media library items.
The code needs to be saved in your child theme's functions.php file, or in a Code Snippets plugin.
// Add "Media" to export drop-down
add_filter( 'wpallexport_custom_types', 'my_add_custom_type', 10, 1 );
function my_add_custom_type( $custom_types ) {
$name = 'Media';
$slug = 'attachment';
if ( ! array_key_exists( $slug, $custom_types ) ) {
$custom_types[ $slug ] = new stdClass();
$custom_types[ $slug ]->labels = new stdClass();
$custom_types[ $slug ]->labels->name = __( $name,'wp_all_export_plugin');
}
return $custom_types;
}
// Add "Media" to import drop-down
add_filter( 'pmxi_custom_types', 'wpai_add_attachment_post_type_to_import_list', 10, 2 );
function wpai_add_attachment_post_type_to_import_list( $custom_types, $type = '' ) {
$display_name = 'Media'; // what goes in the drop down list
$name = 'attachment'; // the post type name
if ( $type == 'all_types' && ! array_key_exists( $name, $custom_types ) ) {
global $wpdb;
$custom_types[ $name ] = (object) array( 'name' => $name, 'label' => $display_name, 'labels' );
$custom_types[ $name ]->labels = (object) array( 'name' => $display_name );
}
return $custom_types;
}