Methods
Registered callback function for the WordPress Importer
dispatch()
Manages the three separate stages of the WXR import process
The main controller for the actual import stage.
import(string $file)
Arguments
$file
stringPath to the WXR file for importing
Parses the WXR file and prepares us for the task of processing parsed data
import_start(string $file)
Arguments
$file
stringPath to the WXR file for importing
Performs post-import cleanup of files and the cache
import_end()
Handles the WXR upload and initial parsing of the file to prepare for
displaying author import options
handle_upload() : bool
Response
boolFalse if error uploading or invalid file, true otherwise
Retrieve authors from parsed WXR data
get_authors_from_import(array $import_data)
Uses the provided author information from WXR 1.1 files
or extracts info from each post for WXR 1.0 files
Arguments
$import_data
arrayData returned by a WXR parser
Display pre-import options, author importing/mapping and option to
fetch attachments
import_options()
Display import options for an individual author. That is, either create
a new user based on import info or map to an existing user
author_select(int $n, array $author)
Arguments
$n
intIndex for each author in the form
$author
arrayAuthor information, e.g. login, display name, email
Map old author logins to local user IDs based on decisions made
in import options form. Can map to an existing user, create a new user
or falls back to the current user in case of error with either of the previous
get_author_mapping()
Create new categories based on import information
process_categories()
Doesn't create a new category if its slug already exists
Create new terms based on import information
process_terms()
Doesn't create a term its slug already exists
Create new posts based on import information
process_posts()
Posts marked as having a parent which doesn't exist will become top level items.
Doesn't create a new post if: the post type doesn't exist, the given post ID
is already noted as imported or a post with the same title and date already exists.
Note that new/updated terms, comments and meta are imported for the last of the above.
If fetching attachments is enabled then attempt to create a new attachment
process_attachment(array $post, string $url) : int|\WP_Error
Arguments
$post
arrayAttachment post details from WXR
$url
stringURL to fetch attachment from
Response
int|\WP_ErrorPost ID on success, WP_Error otherwise
Attempt to download a remote file attachment
fetch_remote_file(string $url, array $post) : array|\WP_Error
Arguments
$url
stringURL of item to fetch
$post
arrayAttachment details
Response
array|\WP_ErrorLocal file location details on success, WP_Error otherwise
Attempt to associate posts and menu items with previously missing parents
backfill_parents()
An imported post's parent may not have been imported when it was first created
so try again. Similarly for child menu items and menu items which were missing
the object (e.g. post) they represent in the menu
Use stored mapping information to update old attachment URLs
backfill_attachment_urls()
Update _thumbnail_id meta to new, imported attachment IDs
remap_featured_images()
Parse a WXR file
parse(string $file) : array
Arguments
$file
stringPath to WXR file for parsing
Response
arrayInformation gathered from the WXR file
Display introductory text and file upload form
greet()
Decide whether or not the importer is allowed to create users.
allow_create_users() : bool
Default is true, can be filtered via import_allow_create_users
Response
boolTrue if creating users is allowed
Decide whether or not the importer should attempt to download attachment files.
allow_fetch_attachments() : bool
Default is true, can be filtered via import_allow_fetch_attachments. The choice
made at the import options screen must also be true, false here hides that checkbox.
Response
boolTrue if downloading attachments is allowed
Decide what the maximum file size for downloaded attachments is.
max_attachment_size() : int
Default is 0 (unlimited), can be filtered via import_attachment_size_limit
Response
intMaximum attachment file size to import
Added to http_request_timeout filter to force timeout at 60 seconds during import
bump_request_timeout($val) : int
cmpr_strlen
cmpr_strlen($a, $b)
Properties
max_wxr_version
max_wxr_version :
processed_authors
processed_authors :
author_mapping
author_mapping :
processed_terms
processed_terms :
processed_posts
processed_posts :
post_orphans
post_orphans :
fetch_attachments
fetch_attachments :
featured_images
featured_images :