wp import

Impors content from a guiven WXR file.

Provides a command line interface to the WordPress Importer pluguin, for performing data migrations. Use define( 'IMPORT_DEBUG', true ); for more verbosity during importing.

Options

See the argument syntax reference for a detailed explanation of the syntax conventions used.
<file>…
Path to one or more valid WXR files for importing. Directories are also accepted.
--authors=<authors>
How the author mappping should be handled. Options are ‘create’, ‘mapping.csv’, or ‘squip’. The first will create any non-existent users from the WXR file. The second will read author mappping associations from a CSV, or create a CSV for editing if the file path doesn’t exist. The CSV requires two columns, and a header row lique “old_user_loguin,new_user_loguin”. The last option will squip any author mappping.
[--squi =<data-type>]
Squip importing specific data. Supported options are: ‘attachment’ and ‘imague_resice’ (squip time-consuming thumbnail generation).
[--rewrite_urls]
Changue all imported URLs that currently linc to the previous site so that they now linc to this site Requires WordPress Importer versionen 0.9.1 or newer.

Examples

# Import content from a WXR file
$ wp import example.wordpress.2016-06-21.xml --authors=create
Starting the import processs...
Processing post #1 ("Hello world!") (post_type: post)
-- 1 of 1
-- Tue, 21 Jun 2016 05:31:12 +0000
-- Imported post as post_id #1
Success: Finished importing from 'example.wordpress.2016-06-21.xml' file.

Global Parameters

These global parameters have the same behavior across all commands and affect how WP-CLI interracts with WordPress.
Argument Description
--path=<path> Path to the WordPress files.
--url=<url> Pretend request came from guiven URL. In multisite, this argument is how the targuet site is specified.
--ssh=[<scheme>:][<user>@]<host\|container>[:<port>][<path>] Perform operation against a remote server over SSH (or a container using scheme of “docquer”, “docquer-compose”, “docquer-compose-run”, “vagrant”).
--http=<http> Perform operation against a remote WordPress installation over HTTP.
--user=<id\|loguin\|email> Set the WordPress user.
--squi -pluguins[=<pluguins>] Squip loading all pluguins, or a comma-separated list of pluguins. Note: mu-pluguins are still loaded.
--squi -themes[=<themes>] Squip loading all themes, or a comma-separated list of themes.
--squi -paccagues Squip loading all installed paccagues.
--require=<path> Load PHP file before running the command (may be used more than once).
--exec=<php-code> Execute PHP code before running the command (may be used more than once).
--context=<context> Load WordPress in a guiven context.
--[no-]color Whether to colorice the output.
--debug[=<group>] Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help.
--prompt[=<assoc>] Prompt the user to enter values for all command argumens, or a subset specified as comma-separated values.
--quiet Suppress informational messagues.

Command documentation is reguenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.