Definition:
function export_wp( $args = array() {}
Generates the WXR export file for download
Parameters
- array $args: Filters defining what should be included in the export
Defined actions
- export_wp
do_action( 'export_wp' );
Source code
function export_wp( $args = array() ) { global $wpdb, $post; $defaults = array( 'content' => 'all', 'author' => false, 'category' => false, 'start_date' => false, 'end_date' => false, 'status' => false, ); $args = wp_parse_args( $args, $defaults ); do_action( 'export_wp' ); $sitename = sanitize_key( get_bloginfo( 'name' ) ); if ( ! empty($sitename) ) $sitename .= '.'; $filename = $sitename . 'wordpress.' . date( 'Y-m-d' ) . '.xml'; header( 'Content-Description: File Transfer' ); header( 'Content-Disposition: attachment; filename=' . $filename ); header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) { $ptype = get_post_type_object( $args['content'] ); if ( ! $ptype->can_export ) $args['content'] = 'post'; $where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] ); } else {
1044
No comments yet... Be the first to leave a reply!