WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#52470 new defect (bug)

Exported WXR contains terms twice

Reported by: karl94 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Export Keywords:
Focuses: Cc:

Description

How to reproduce: after a fresh WordPress install (no active plugins) go make a WXR export file. If you open the WRX file you'll notice the Uncategorized appears twice: the first time as wp:category element, the second as a wp:term.
The wp:category comes from https://github.com/WordPress/WordPress/blob/5.6.1/wp-admin/includes/export.php#L158, the wp:term from https://github.com/WordPress/WordPress/blob/5.6.1/wp-admin/includes/export.php#L162-L167. With the setup described (no plugins) the only registered taxonomies are the builtin ones, therefore $custom_taxonomies contains an empty array. When get_terms() receives an empty array as the taxonomies param it will return all terms, of every taxonomy.
This also means that if there are other taxonomies registered the issue doesn't show up.

This is a regression: on WordPress 4.4 it doesn't happen.
A git bisect pointed to https://github.com/WordPress/WordPress/commit/3f7441d674d304a8ad0912831aa9685cdc8bff93 as the culprit.
The commit states that it maintains backwards compatibility, but it does not in case an empty array is passed as taxonomy param.

Change History (2)

#1 @sabernhardt
2 months ago

  • Component changed from General to Export

#2 @hellofromTonya
2 months ago

  • Version trunk deleted

Removing trunk as the Version as predates 5.7 (current trunk). Actual trunk can be set once root cause is identified.

Note: See TracTickets for help on using tickets.