Methods
WPV_Import()
WPV_Import()
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
Returns
bool
True 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.
Returns
bool
True if downloading attachments is allowed
Display import options for an individual author.
author_select(int $n, array $author)
That is, either create
a new user based on import info or map to an existing user
Parameters
$n
int
Index for each author in the form
$author
array
Author information, e.g. login, display name, email
Use stored mapping information to update old attachment URLs
backfill_attachment_urls()
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
Added to http_request_timeout filter to force timeout at 60 seconds during import
bump_request_timeout() : int
cmpr_strlen()
cmpr_strlen($a, $b)
Registered callback function for the WordPress Importer
dispatch()
Manages the three separate stages of the WXR import process
Attempt to download a remote file attachment
fetch_remote_file(string $url, array $post) : array | \WP_Error
Parameters
$url
string
URL of item to fetch
$post
array
Attachment details
Returns
array
\WP_Error
Local file location details on success, WP_Error otherwise
Map old author logins to local user IDs based on decisions made
in import options form.
get_author_mapping()
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
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
Parameters
$import_data
array
Data returned by a WXR parser
Display introductory text and file upload form
greet()
Handles the WXR upload and initial parsing of the file to prepare for
displaying author import options
handle_upload() : bool
Returns
bool
False if error uploading or invalid file, true otherwise
The main controller for the actual import stage.
import(string $file)
Parameters
$file
string
Path to the WXR file for importing
Performs post-import cleanup of files and the cache
import_end()
Display pre-import options, author importing/mapping and option to
fetch attachments
import_options()
Parses the WXR file and prepares us for the task of processing parsed data
import_start(string $file)
Parameters
$file
string
Path to the WXR file for importing
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
Returns
int
Maximum attachment file size to import
Parse a WXR file
parse(string $file) : array
Parameters
$file
string
Path to WXR file for parsing
Returns
array
Information gathered from the WXR file
If fetching attachments is enabled then attempt to create a new attachment
process_attachment(array $post, string $url) : int | \WP_Error
Parameters
$post
array
Attachment post details from WXR
$url
string
URL to fetch attachment from
Returns
int
\WP_Error
Post ID on success, WP_Error otherwise
Create new categories based on import information
process_categories()
Doesn't create a new category if 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.
Create new terms based on import information
process_terms()
Doesn't create a term its slug already exists
Update _thumbnail_id meta to new, imported attachment IDs
remap_featured_images()
Properties