19
19
* Generates the WXR export file for download.
21
* Default behavior is to export all content, however, note that post content will only
22
* be exported for post types with the `can_export` argument enabled. Any posts with the
23
* 'auto-draft' status will be skipped.
24
* @global WP_Post $post
26
* @param array $args Filters defining what should be included in the export.
27
* @global wpdb $wpdb WordPress database abstraction object.
28
* @global WP_Post $post Global `$post`.
30
* @param array $args {
31
* Optional. Arguments for generating the WXR export file for download. Default empty array.
33
* @type string $content Type of content to export. If set, only the post content of this post type
34
* will be exported. Accepts 'all', 'post', 'page', 'attachment', or a defined
35
* custom post. If an invalid custom post type is supplied, every post type for
36
* which `can_export` is enabled will be exported instead. If a valid custom post
37
* type is supplied but `can_export` is disabled, then 'posts' will be exported
38
* instead. When 'all' is supplied, only post types with `can_export` enabled will
39
* be exported. Default 'all'.
40
* @type string $author Author to export content for. Only used when `$content` is 'post', 'page', or
41
* 'attachment'. Accepts false (all) or a specific author ID. Default false (all).
42
* @type string $category Category (slug) to export content for. Used only when `$content` is 'post'. If
43
* set, only post content assigned to `$category will be exported. Accepts false
44
* or a specific category slug. Default is false (all categories).
45
* @type string $start_date Start date to export content from. Expected date format is 'Y-m-d'. Used only
46
* when `$content` is 'post', 'page' or 'attachment'. Default false (since the
48
* @type string $end_date End date to export content to. Expected date format is 'Y-m-d'. Used only when
49
* `$content` is 'post', 'page' or 'attachment'. Default false (latest publish date).
50
* @type string $status Post status to export posts for. Used only when `$content` is 'post' or 'page'.
51
* Accepts false (all statuses except 'auto-draft'), or a specific status, i.e.
52
* 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', or
53
* 'trash'. Default false (all statuses except 'auto-draft').
28
56
function export_wp( $args = array() ) {
29
57
global $wpdb, $post;