PHP Class Import_Command, wp-cli

Inheritance: extends WP_CLI_Command
显示文件 Open project: wp-cli/wp-cli

Public Properties

Property Type Description
$processed_posts

Public Methods

Method Description
__invoke ( $args, $assoc_args ) Import content from a WXR file.
filter_set_image_sizes ( $sizes )

Private Methods

Method Description
add_wxr_filters ( ) Useful verbosity filters for the WXR importer
create_author_mapping_file ( $file, $author_data ) : WP_Error Create an author mapping file, based on provided author data
create_authors_for_mapping ( $author_data ) Create users if they don't exist, and build an author mapping file
import_wxr ( $file, $args ) Import a WXR file
is_importer_available ( ) Is the requested importer available?
process_author_mapping ( string $authors_arg, array $author_data ) : array | WP_Error Process how the authors should be mapped
read_author_mapping_file ( $file ) Read an author mapping file
suggest_user ( $author_user_login, $author_user_email = '' ) Suggest a blog user based on the levenshtein distance

Method Details

__invoke() public method

Provides a command line interface to the WordPress Importer plugin, for performing data migrations. ## OPTIONS ... : Path to one or more valid WXR files for importing. Directories are also accepted. --authors= : How the author mapping should be handled. Options are 'create', 'mapping.csv', or 'skip'. The first will create any non-existent users from the WXR file. The second will read author mapping 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 like "old_user_login,new_user_login". The last option will skip any author mapping. [--skip=] : Skip importing specific data. Supported options are: 'attachment' and 'image_resize' (skip time-consuming thumbnail generation). ## EXAMPLES # Import content from a WXR file $ wp import example.wordpress.2016-06-21.xml --authors=create Starting the import process... 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.
public __invoke ( $args, $assoc_args )

filter_set_image_sizes() public method

public filter_set_image_sizes ( $sizes )

Property Details

$processed_posts public_oe property

public $processed_posts