[WordPress] WP-CLIテストデータインポートする方法

1 min read
hiroweb developer

方法

wget で GitHub 上のデータを取得して、wp import(WP-CLI)で対象の WordPress へインポートする。

英語データ

WPTRT/theme-unit-test: Theme Unit Testを使う。

wget https://raw.githubusercontent.com/WPTRT/theme-unit-test/master/themeunittestdata.wordpress.xml --no-check-certificate  && wp plugin install wordpress-importer --activate && wp import themeunittestdata.wordpress.xml --authors=create && rm themeunittestdata.wordpress.xml

日本語データ

jawordpressorg/theme-test-data-ja: Japanese test data for WordPressで先述の日本語版が公開されている。

wget https://raw.githubusercontent.com/jawordpressorg/theme-test-data-ja/master/wordpress-theme-test-date-ja.xml --no-check-certificate  && wp plugin install wordpress-importer --activate && wp import wordpress-theme-test-date-ja.xml --authors=create && rm wordpress-theme-test-date-ja.xml

参考