Make WordPress Core

Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#20206 closed enhancement (fixed)

WXR unnecessarily includes all post authors

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: 4.0 Priority: normal
Severity: normal Version: 3.3
Component: Export Keywords: has-patch
Focuses: Cc:

Description

If you're exporting just one post type (from Tools -> Export), the resulting WXR file still includes all authors from the posts table, regardless if they are the author of a post of the post type being exported. This can be particularly noticable for Pages (which are often only authored by a small number of different users on the site) and for custom post types.

This means when you subsequently import the file you'll be asked to map a complete list of all authors from the exported site, even if they have no posts in the WXR file being imported.

Attachments (2)

20206.patch (1.6 KB) - added by johnbillion 13 years ago.
20206.2.diff (1.3 KB) - added by jeremyfelt 13 years ago.
Updated patch using $post_ids

Download all attachments as: .zip

Change History (12)

@johnbillion
13 years ago

#1 @johnbillion
13 years ago

  • Keywords has-patch added

Patch to only include relevant post authors in the WXR export.

#2 @jeremyfelt
13 years ago

  • Cc jeremy.felt@… added

I really like this idea. It makes sense to export all of the data based on the selected parameters.

It may make more sense to reuse the $post_ids array so that the query for distinct post authors mirrors the results from the main posts query. Restricting it to post_type could cause the same issue with extra authors for some taxonomies, etc...

The updated patch attached uses the $post_ids array instead.

@jeremyfelt
13 years ago

Updated patch using $post_ids

#3 @johnbillion
13 years ago

Even better!

#4 @johnbillion
10 years ago

#28450 was marked as a duplicate.

#5 @SergeyBiryukov
10 years ago

  • Milestone changed from Awaiting Review to 4.0

#6 @khromov
10 years ago

Glad to see this is getting some traction! Hoping for inclusion in 4.0!

#7 @johnbillion
10 years ago

  • Owner set to johnbillion
  • Resolution set to fixed
  • Status changed from new to closed

In 28731:

Only include relevant post authors in WXR exports. Fixes #20206. Props jeremyfelt.

#8 @nacin
10 years ago

Not sure if this requires re-opening, but does this fully cover things like attachments (either attached to a post or as a featured image) that would also need to be (but may not yet be) included in such an export?

#9 @johnbillion
10 years ago

Good spot.

If you don't limit your export to a certain post type, attachments are included in the export and all author IDs are present and correct, so we're ok.

If you do limit your export to a certain post type, the featured image post is not included in the export and gets lost. This is covered in #17379.

#10 @lkraav
10 years ago

This is huge. Just had to say that out loud.

Note: See TracTickets for help on using tickets.