WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 5 months ago

#17379 new feature request

Filtered exports drop attachments and featured images

Reported by: billseymour Owned by:
Priority: normal Milestone: Awaiting Review
Component: Export Version: 3.0
Severity: normal Keywords: has-patch
Cc: ipstenu@…, johnbillion, justin@…, jarretcade@…, batmoo@…, travis@…, wingfingerbill, lachlan@…

Description

When using Tools>Export, targeting a specific author, the resulting XML file does not contain a reference/link to any Featured Image (thumbnail) associated with these posts.

On the other hand, Tools>Export "all content" (including all authors) produces an XML file that does contain reference/link to Featured Image.

Request: Have Tools>Export "specific author" generate the same metadata as the "all content" export, so that Export "specific author" will also include metadata reference to the Featured Image.

Many people (including myself) use "specific author" as a way to export some, but not all, posts. Full metadata would really help. Thanks.

Attachments (1)

export_attachments_for_cpt.diff (1.3 KB) - added by jghazally 14 months ago.
Include attachments for specific post_types

Download all attachments as: .zip

Change History (21)

comment:1 duck_2 years ago

The problem isn't missing meta data (see <wp:meta_key>_thumbnail_id</wp:meta_key>). Rather the fact that no attachments are exported/imported so the reference doesn't mean anything in the imported install.

comment:2 jane18 months ago

  • Summary changed from Export Posts by Author- Featured Image reference to Export Posts by Author needs Featured Image reference

comment:3 duck_18 months ago

  • Component changed from General to Export
  • Summary changed from Export Posts by Author needs Featured Image reference to Filtered exports drop attachments and featured images
  • Version set to 3.0

Marked #19591 as dupe. Definitely present in 3.0, and I'm pretty sure it was present earlier than that but I haven't checked.

Related: #19307

comment:4 rcain15 months ago

thought it might be helpful to suggest a very simple solution to this:

can we not have an 'export attachments only' option (alongside 'export posts only', etc)?

i've just implemented similar in the old advanced-export-forwp-wpmu plugin here : http://wordpress.org/support/topic/plugin-advanced-export-for-wp-wpmu-how-to-export-attachments-only - which i believe is pretty similar code.

since big exports generally have to be done in smaller batches anyway, exporting attachments separately seems logical.

on the flip-side, there still appear to be some issues with the wordpress-importer plugin (eg: http://wordpress.org/support/topic/plugin-wordpress-importer-not-importing-any-images-at-all), but this would seem a practical step in the right direction.

comment:5 Ipstenu15 months ago

  • Cc ipstenu@… added

comment:6 johnbillion15 months ago

  • Cc johnbillion added

comment:7 jtsternberg14 months ago

  • Cc justin@… added

comment:8 JarretC14 months ago

  • Cc jarretcade@… added

jghazally14 months ago

Include attachments for specific post_types

comment:9 jghazally14 months ago

Hi I just came across this problem when trying to import a CPT, the featured images (and other attachments) are not included in the xml file. I have attached a patch above to fix my issue which is fairly basic and can probably be improved. It can also be made to utilize a checkbox as per @rcain 's suggestion.
Hope this helps core out.

best
jeff

comment:10 batmoo14 months ago

  • Cc batmoo@… added

comment:11 smub13 months ago

Just ran into this issue. This also breaks conditionals like has_post_thumbnail() ... Just exported about 24 posts from a site to test on local dev environment (building a new theme). Put up some dummy thumbnails on few articles. Then added a custom field for image URLs (just to simulate posts from pre WP 2.9)... Was running a conditional and it wasn't working. Spend all the time just to realize it was because an attachment ID was saved. So while it doesn't display a thumbnail that is attached, it stores an ID in the database thus causing the conditional to return TRUE when it is not.

comment:12 travisnorthcutt13 months ago

  • Cc travis@… added

A big fat +1 from me on this. My use case was exporting/importing a custom post type with associated featured images. The code posted by @jghazally worked *perfectly* for me.

comment:13 wingfingerbill11 months ago

  • Cc wingfingerbill added

comment:14 jghazally11 months ago

If someone wants to give me an idea of what sort of UI / form elements we want to use, and a hand getting started on Unit Testing this would love to help...

best
jeff

comment:15 batmoo9 months ago

export_attachments_for_cpt.diff works pretty nicely. Would be nice to get this into 3.5.

comment:16 axwax9 months ago

+1 on getting that patch by @jghazally into 3.5,
as in its current form it does indeed mess up the database as @smub mentioned above...

Last edited 9 months ago by axwax (previous) (diff)

comment:17 creativeslice6 months ago

  • Keywords has-patch added

We've been able to get this to work with a hack to the Advanced Export plugin, however it's quite brittle and only allows you to filter by date and author, not category. It would be great to have this fixed in core so exporting a range of posts works without dropping images.

comment:18 lachlanj5 months ago

  • Cc lachlan@… added

comment:19 dlocc5 months ago

Thanks to the export_attachments_for_cpt.diff for working great! I'm happy I found this... saved me bunches of time. Why wasn't this included in 3.5? It should definitely be rolled out.

comment:20 jghazally5 months ago

@dlocc the export system is getting overhauled and a new API is being developed see #22435

Note: See TracTickets for help on using tickets.