diff --git a/features/export.feature b/features/export.feature index b6849d05..73c36e3f 100644 --- a/features/export.feature +++ b/features/export.feature @@ -985,3 +985,35 @@ Feature: Export content. """ Europe """ + + @require-wp-5.2 + Scenario: Export posts should not include oembed_cache posts user information + Given a WP install + And I run `wp plugin install wordpress-importer --activate` + And I run `wp user create user user@user.com --role=editor --display_name="Test User"` + And I run `wp user create oembed_cache_user oembed_cache@user.com --role=editor --display_name="Oembed User"` + And I run `wp post generate --post_type=post --count=10 --post_author=user` + And I run `wp post generate --post_type=oembed_cache --count=1 --post_author=oembed_cache_user` + + When I run `wp export` + And save STDOUT 'Writing to file %s' as {EXPORT_FILE} + Then the {EXPORT_FILE} file should contain: + """ + + """ + And the {EXPORT_FILE} file should not contain: + """ + + """ + When I run `wp site empty --yes` + And I run `wp user list --field=user_login | xargs -n 1 wp user delete --yes` + Then STDOUT should not be empty + + When I run `wp import {EXPORT_FILE} --authors=create` + Then STDOUT should not be empty + + When I run `wp user get user --field=display_name` + Then STDOUT should be: + """ + Test User + """ diff --git a/src/WP_Export_Query.php b/src/WP_Export_Query.php index 262f6e6e..8b900f7d 100644 --- a/src/WP_Export_Query.php +++ b/src/WP_Export_Query.php @@ -80,7 +80,7 @@ public function authors() { } $authors = []; - $author_ids = (array) $wpdb->get_col( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft'" ); + $author_ids = (array) $wpdb->get_col( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' AND post_type != 'oembed_cache'" ); foreach ( $author_ids as $author_id ) { $authors[] = get_userdata( $author_id ); }