wp-cli / export-command

Exports WordPress content to a WXR file.
MIT License
12 stars 27 forks source link

Exclude unnecessary author ids from oembed_cache posts in export #98

Closed ouikhuan closed 1 year ago

ouikhuan commented 1 year ago

Bug Report

Describe the current, buggy behavior

This aligns with the fix we did here: D93881-code for wpcom

oembed cache has been introduced in terms of the https://core.trac.wordpress.org/ticket/34115 ticket. Originally, the oembed cache used to be stored only inside a post meta. Which led to situations where there were no oembeds displayed in case the global $post variable was not set up (there was an early return in the code preventing the oembed being served without a possibility to cache the result). That’s what has been patched by introducing the oembed_cache post type where the oembed cache lives for such cases. Because of this change, when you export a blog, you'll see an unrelated user show up as an author in the export file.

Describe how other contributors can replicate this bug

An example where a oembed_cache post type is created is where there is a text widget with a URL(Youtube, Twitter, Facebook, etc.) in it’s content in a sidebar on a search screen which failed to find any posts. An example where such post is attributed via post_author field to a non-member of a side, is when such a search returning no posts is triggered by a logged-in user.

Because of the reason above, when we export a blog, the post_author of oembed_cache will also get included.

Describe what you would expect as the correct outcome

The author of oembed_cache posts shouldn't show up as a wp:author in the export file