Edit File by line
/home/barbar84/www/wp-admin/includes
File: export.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WordPress Export Administration API
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Version number for the export format.
[9] Fix | Delete
*
[10] Fix | Delete
* Bump this when something changes that might affect compatibility.
[11] Fix | Delete
*
[12] Fix | Delete
* @since 2.5.0
[13] Fix | Delete
*/
[14] Fix | Delete
define( 'WXR_VERSION', '1.2' );
[15] Fix | Delete
[16] Fix | Delete
/**
[17] Fix | Delete
* Generates the WXR export file for download.
[18] Fix | Delete
*
[19] Fix | Delete
* Default behavior is to export all content, however, note that post content will only
[20] Fix | Delete
* be exported for post types with the `can_export` argument enabled. Any posts with the
[21] Fix | Delete
* 'auto-draft' status will be skipped.
[22] Fix | Delete
*
[23] Fix | Delete
* @since 2.1.0
[24] Fix | Delete
* @since 5.7.0 Added the `post_modified` and `post_modified_gmt` fields to the export file.
[25] Fix | Delete
*
[26] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[27] Fix | Delete
* @global WP_Post $post Global post object.
[28] Fix | Delete
*
[29] Fix | Delete
* @param array $args {
[30] Fix | Delete
* Optional. Arguments for generating the WXR export file for download. Default empty array.
[31] Fix | Delete
*
[32] Fix | Delete
* @type string $content Type of content to export. If set, only the post content of this post type
[33] Fix | Delete
* will be exported. Accepts 'all', 'post', 'page', 'attachment', or a defined
[34] Fix | Delete
* custom post. If an invalid custom post type is supplied, every post type for
[35] Fix | Delete
* which `can_export` is enabled will be exported instead. If a valid custom post
[36] Fix | Delete
* type is supplied but `can_export` is disabled, then 'posts' will be exported
[37] Fix | Delete
* instead. When 'all' is supplied, only post types with `can_export` enabled will
[38] Fix | Delete
* be exported. Default 'all'.
[39] Fix | Delete
* @type string $author Author to export content for. Only used when `$content` is 'post', 'page', or
[40] Fix | Delete
* 'attachment'. Accepts false (all) or a specific author ID. Default false (all).
[41] Fix | Delete
* @type string $category Category (slug) to export content for. Used only when `$content` is 'post'. If
[42] Fix | Delete
* set, only post content assigned to `$category` will be exported. Accepts false
[43] Fix | Delete
* or a specific category slug. Default is false (all categories).
[44] Fix | Delete
* @type string $start_date Start date to export content from. Expected date format is 'Y-m-d'. Used only
[45] Fix | Delete
* when `$content` is 'post', 'page' or 'attachment'. Default false (since the
[46] Fix | Delete
* beginning of time).
[47] Fix | Delete
* @type string $end_date End date to export content to. Expected date format is 'Y-m-d'. Used only when
[48] Fix | Delete
* `$content` is 'post', 'page' or 'attachment'. Default false (latest publish date).
[49] Fix | Delete
* @type string $status Post status to export posts for. Used only when `$content` is 'post' or 'page'.
[50] Fix | Delete
* Accepts false (all statuses except 'auto-draft'), or a specific status, i.e.
[51] Fix | Delete
* 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', or
[52] Fix | Delete
* 'trash'. Default false (all statuses except 'auto-draft').
[53] Fix | Delete
* }
[54] Fix | Delete
*/
[55] Fix | Delete
function export_wp( $args = array() ) {
[56] Fix | Delete
global $wpdb, $post;
[57] Fix | Delete
[58] Fix | Delete
$defaults = array(
[59] Fix | Delete
'content' => 'all',
[60] Fix | Delete
'author' => false,
[61] Fix | Delete
'category' => false,
[62] Fix | Delete
'start_date' => false,
[63] Fix | Delete
'end_date' => false,
[64] Fix | Delete
'status' => false,
[65] Fix | Delete
);
[66] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[67] Fix | Delete
[68] Fix | Delete
/**
[69] Fix | Delete
* Fires at the beginning of an export, before any headers are sent.
[70] Fix | Delete
*
[71] Fix | Delete
* @since 2.3.0
[72] Fix | Delete
*
[73] Fix | Delete
* @param array $args An array of export arguments.
[74] Fix | Delete
*/
[75] Fix | Delete
do_action( 'export_wp', $args );
[76] Fix | Delete
[77] Fix | Delete
$sitename = sanitize_key( get_bloginfo( 'name' ) );
[78] Fix | Delete
if ( ! empty( $sitename ) ) {
[79] Fix | Delete
$sitename .= '.';
[80] Fix | Delete
}
[81] Fix | Delete
$date = gmdate( 'Y-m-d' );
[82] Fix | Delete
$wp_filename = $sitename . 'WordPress.' . $date . '.xml';
[83] Fix | Delete
/**
[84] Fix | Delete
* Filters the export filename.
[85] Fix | Delete
*
[86] Fix | Delete
* @since 4.4.0
[87] Fix | Delete
*
[88] Fix | Delete
* @param string $wp_filename The name of the file for download.
[89] Fix | Delete
* @param string $sitename The site name.
[90] Fix | Delete
* @param string $date Today's date, formatted.
[91] Fix | Delete
*/
[92] Fix | Delete
$filename = apply_filters( 'export_wp_filename', $wp_filename, $sitename, $date );
[93] Fix | Delete
[94] Fix | Delete
header( 'Content-Description: File Transfer' );
[95] Fix | Delete
header( 'Content-Disposition: attachment; filename=' . $filename );
[96] Fix | Delete
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
[97] Fix | Delete
[98] Fix | Delete
if ( 'all' !== $args['content'] && post_type_exists( $args['content'] ) ) {
[99] Fix | Delete
$ptype = get_post_type_object( $args['content'] );
[100] Fix | Delete
if ( ! $ptype->can_export ) {
[101] Fix | Delete
$args['content'] = 'post';
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
$where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] );
[105] Fix | Delete
} else {
[106] Fix | Delete
$post_types = get_post_types( array( 'can_export' => true ) );
[107] Fix | Delete
$esses = array_fill( 0, count( $post_types ), '%s' );
[108] Fix | Delete
[109] Fix | Delete
// phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare
[110] Fix | Delete
$where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
if ( $args['status'] && ( 'post' === $args['content'] || 'page' === $args['content'] ) ) {
[114] Fix | Delete
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
[115] Fix | Delete
} else {
[116] Fix | Delete
$where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
$join = '';
[120] Fix | Delete
if ( $args['category'] && 'post' === $args['content'] ) {
[121] Fix | Delete
$term = term_exists( $args['category'], 'category' );
[122] Fix | Delete
if ( $term ) {
[123] Fix | Delete
$join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
[124] Fix | Delete
$where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] );
[125] Fix | Delete
}
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
if ( in_array( $args['content'], array( 'post', 'page', 'attachment' ), true ) ) {
[129] Fix | Delete
if ( $args['author'] ) {
[130] Fix | Delete
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
if ( $args['start_date'] ) {
[134] Fix | Delete
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", gmdate( 'Y-m-d', strtotime( $args['start_date'] ) ) );
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
if ( $args['end_date'] ) {
[138] Fix | Delete
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", gmdate( 'Y-m-d', strtotime( '+1 month', strtotime( $args['end_date'] ) ) ) );
[139] Fix | Delete
}
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
// Grab a snapshot of post IDs, just in case it changes during the export.
[143] Fix | Delete
$post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" );
[144] Fix | Delete
[145] Fix | Delete
/*
[146] Fix | Delete
* Get the requested terms ready, empty unless posts filtered by category
[147] Fix | Delete
* or all content.
[148] Fix | Delete
*/
[149] Fix | Delete
$cats = array();
[150] Fix | Delete
$tags = array();
[151] Fix | Delete
$terms = array();
[152] Fix | Delete
if ( isset( $term ) && $term ) {
[153] Fix | Delete
$cat = get_term( $term['term_id'], 'category' );
[154] Fix | Delete
$cats = array( $cat->term_id => $cat );
[155] Fix | Delete
unset( $term, $cat );
[156] Fix | Delete
} elseif ( 'all' === $args['content'] ) {
[157] Fix | Delete
$categories = (array) get_categories( array( 'get' => 'all' ) );
[158] Fix | Delete
$tags = (array) get_tags( array( 'get' => 'all' ) );
[159] Fix | Delete
[160] Fix | Delete
$custom_taxonomies = get_taxonomies( array( '_builtin' => false ) );
[161] Fix | Delete
$custom_terms = (array) get_terms(
[162] Fix | Delete
array(
[163] Fix | Delete
'taxonomy' => $custom_taxonomies,
[164] Fix | Delete
'get' => 'all',
[165] Fix | Delete
)
[166] Fix | Delete
);
[167] Fix | Delete
[168] Fix | Delete
// Put categories in order with no child going before its parent.
[169] Fix | Delete
while ( $cat = array_shift( $categories ) ) {
[170] Fix | Delete
if ( 0 == $cat->parent || isset( $cats[ $cat->parent ] ) ) {
[171] Fix | Delete
$cats[ $cat->term_id ] = $cat;
[172] Fix | Delete
} else {
[173] Fix | Delete
$categories[] = $cat;
[174] Fix | Delete
}
[175] Fix | Delete
}
[176] Fix | Delete
[177] Fix | Delete
// Put terms in order with no child going before its parent.
[178] Fix | Delete
while ( $t = array_shift( $custom_terms ) ) {
[179] Fix | Delete
if ( 0 == $t->parent || isset( $terms[ $t->parent ] ) ) {
[180] Fix | Delete
$terms[ $t->term_id ] = $t;
[181] Fix | Delete
} else {
[182] Fix | Delete
$custom_terms[] = $t;
[183] Fix | Delete
}
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
unset( $categories, $custom_taxonomies, $custom_terms );
[187] Fix | Delete
}
[188] Fix | Delete
[189] Fix | Delete
/**
[190] Fix | Delete
* Wrap given string in XML CDATA tag.
[191] Fix | Delete
*
[192] Fix | Delete
* @since 2.1.0
[193] Fix | Delete
*
[194] Fix | Delete
* @param string $str String to wrap in XML CDATA tag.
[195] Fix | Delete
* @return string
[196] Fix | Delete
*/
[197] Fix | Delete
function wxr_cdata( $str ) {
[198] Fix | Delete
if ( ! seems_utf8( $str ) ) {
[199] Fix | Delete
$str = utf8_encode( $str );
[200] Fix | Delete
}
[201] Fix | Delete
// $str = ent2ncr(esc_html($str));
[202] Fix | Delete
$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
[203] Fix | Delete
[204] Fix | Delete
return $str;
[205] Fix | Delete
}
[206] Fix | Delete
[207] Fix | Delete
/**
[208] Fix | Delete
* Return the URL of the site
[209] Fix | Delete
*
[210] Fix | Delete
* @since 2.5.0
[211] Fix | Delete
*
[212] Fix | Delete
* @return string Site URL.
[213] Fix | Delete
*/
[214] Fix | Delete
function wxr_site_url() {
[215] Fix | Delete
if ( is_multisite() ) {
[216] Fix | Delete
// Multisite: the base URL.
[217] Fix | Delete
return network_home_url();
[218] Fix | Delete
} else {
[219] Fix | Delete
// WordPress (single site): the blog URL.
[220] Fix | Delete
return get_bloginfo_rss( 'url' );
[221] Fix | Delete
}
[222] Fix | Delete
}
[223] Fix | Delete
[224] Fix | Delete
/**
[225] Fix | Delete
* Output a cat_name XML tag from a given category object
[226] Fix | Delete
*
[227] Fix | Delete
* @since 2.1.0
[228] Fix | Delete
*
[229] Fix | Delete
* @param WP_Term $category Category Object
[230] Fix | Delete
*/
[231] Fix | Delete
function wxr_cat_name( $category ) {
[232] Fix | Delete
if ( empty( $category->name ) ) {
[233] Fix | Delete
return;
[234] Fix | Delete
}
[235] Fix | Delete
[236] Fix | Delete
echo '<wp:cat_name>' . wxr_cdata( $category->name ) . "</wp:cat_name>\n";
[237] Fix | Delete
}
[238] Fix | Delete
[239] Fix | Delete
/**
[240] Fix | Delete
* Output a category_description XML tag from a given category object
[241] Fix | Delete
*
[242] Fix | Delete
* @since 2.1.0
[243] Fix | Delete
*
[244] Fix | Delete
* @param WP_Term $category Category Object
[245] Fix | Delete
*/
[246] Fix | Delete
function wxr_category_description( $category ) {
[247] Fix | Delete
if ( empty( $category->description ) ) {
[248] Fix | Delete
return;
[249] Fix | Delete
}
[250] Fix | Delete
[251] Fix | Delete
echo '<wp:category_description>' . wxr_cdata( $category->description ) . "</wp:category_description>\n";
[252] Fix | Delete
}
[253] Fix | Delete
[254] Fix | Delete
/**
[255] Fix | Delete
* Output a tag_name XML tag from a given tag object
[256] Fix | Delete
*
[257] Fix | Delete
* @since 2.3.0
[258] Fix | Delete
*
[259] Fix | Delete
* @param WP_Term $tag Tag Object
[260] Fix | Delete
*/
[261] Fix | Delete
function wxr_tag_name( $tag ) {
[262] Fix | Delete
if ( empty( $tag->name ) ) {
[263] Fix | Delete
return;
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . "</wp:tag_name>\n";
[267] Fix | Delete
}
[268] Fix | Delete
[269] Fix | Delete
/**
[270] Fix | Delete
* Output a tag_description XML tag from a given tag object
[271] Fix | Delete
*
[272] Fix | Delete
* @since 2.3.0
[273] Fix | Delete
*
[274] Fix | Delete
* @param WP_Term $tag Tag Object
[275] Fix | Delete
*/
[276] Fix | Delete
function wxr_tag_description( $tag ) {
[277] Fix | Delete
if ( empty( $tag->description ) ) {
[278] Fix | Delete
return;
[279] Fix | Delete
}
[280] Fix | Delete
[281] Fix | Delete
echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . "</wp:tag_description>\n";
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
/**
[285] Fix | Delete
* Output a term_name XML tag from a given term object
[286] Fix | Delete
*
[287] Fix | Delete
* @since 2.9.0
[288] Fix | Delete
*
[289] Fix | Delete
* @param WP_Term $term Term Object
[290] Fix | Delete
*/
[291] Fix | Delete
function wxr_term_name( $term ) {
[292] Fix | Delete
if ( empty( $term->name ) ) {
[293] Fix | Delete
return;
[294] Fix | Delete
}
[295] Fix | Delete
[296] Fix | Delete
echo '<wp:term_name>' . wxr_cdata( $term->name ) . "</wp:term_name>\n";
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
/**
[300] Fix | Delete
* Output a term_description XML tag from a given term object
[301] Fix | Delete
*
[302] Fix | Delete
* @since 2.9.0
[303] Fix | Delete
*
[304] Fix | Delete
* @param WP_Term $term Term Object
[305] Fix | Delete
*/
[306] Fix | Delete
function wxr_term_description( $term ) {
[307] Fix | Delete
if ( empty( $term->description ) ) {
[308] Fix | Delete
return;
[309] Fix | Delete
}
[310] Fix | Delete
[311] Fix | Delete
echo "\t\t<wp:term_description>" . wxr_cdata( $term->description ) . "</wp:term_description>\n";
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
/**
[315] Fix | Delete
* Output term meta XML tags for a given term object.
[316] Fix | Delete
*
[317] Fix | Delete
* @since 4.6.0
[318] Fix | Delete
*
[319] Fix | Delete
* @param WP_Term $term Term object.
[320] Fix | Delete
*/
[321] Fix | Delete
function wxr_term_meta( $term ) {
[322] Fix | Delete
global $wpdb;
[323] Fix | Delete
[324] Fix | Delete
$termmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $term->term_id ) );
[325] Fix | Delete
[326] Fix | Delete
foreach ( $termmeta as $meta ) {
[327] Fix | Delete
/**
[328] Fix | Delete
* Filters whether to selectively skip term meta used for WXR exports.
[329] Fix | Delete
*
[330] Fix | Delete
* Returning a truthy value from the filter will skip the current meta
[331] Fix | Delete
* object from being exported.
[332] Fix | Delete
*
[333] Fix | Delete
* @since 4.6.0
[334] Fix | Delete
*
[335] Fix | Delete
* @param bool $skip Whether to skip the current piece of term meta. Default false.
[336] Fix | Delete
* @param string $meta_key Current meta key.
[337] Fix | Delete
* @param object $meta Current meta object.
[338] Fix | Delete
*/
[339] Fix | Delete
if ( ! apply_filters( 'wxr_export_skip_termmeta', false, $meta->meta_key, $meta ) ) {
[340] Fix | Delete
printf( "\t\t<wp:termmeta>\n\t\t\t<wp:meta_key>%s</wp:meta_key>\n\t\t\t<wp:meta_value>%s</wp:meta_value>\n\t\t</wp:termmeta>\n", wxr_cdata( $meta->meta_key ), wxr_cdata( $meta->meta_value ) );
[341] Fix | Delete
}
[342] Fix | Delete
}
[343] Fix | Delete
}
[344] Fix | Delete
[345] Fix | Delete
/**
[346] Fix | Delete
* Output list of authors with posts
[347] Fix | Delete
*
[348] Fix | Delete
* @since 3.1.0
[349] Fix | Delete
*
[350] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[351] Fix | Delete
*
[352] Fix | Delete
* @param int[] $post_ids Optional. Array of post IDs to filter the query by.
[353] Fix | Delete
*/
[354] Fix | Delete
function wxr_authors_list( array $post_ids = null ) {
[355] Fix | Delete
global $wpdb;
[356] Fix | Delete
[357] Fix | Delete
if ( ! empty( $post_ids ) ) {
[358] Fix | Delete
$post_ids = array_map( 'absint', $post_ids );
[359] Fix | Delete
$and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')';
[360] Fix | Delete
} else {
[361] Fix | Delete
$and = '';
[362] Fix | Delete
}
[363] Fix | Delete
[364] Fix | Delete
$authors = array();
[365] Fix | Delete
$results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
[366] Fix | Delete
foreach ( (array) $results as $result ) {
[367] Fix | Delete
$authors[] = get_userdata( $result->post_author );
[368] Fix | Delete
}
[369] Fix | Delete
[370] Fix | Delete
$authors = array_filter( $authors );
[371] Fix | Delete
[372] Fix | Delete
foreach ( $authors as $author ) {
[373] Fix | Delete
echo "\t<wp:author>";
[374] Fix | Delete
echo '<wp:author_id>' . (int) $author->ID . '</wp:author_id>';
[375] Fix | Delete
echo '<wp:author_login>' . wxr_cdata( $author->user_login ) . '</wp:author_login>';
[376] Fix | Delete
echo '<wp:author_email>' . wxr_cdata( $author->user_email ) . '</wp:author_email>';
[377] Fix | Delete
echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>';
[378] Fix | Delete
echo '<wp:author_first_name>' . wxr_cdata( $author->first_name ) . '</wp:author_first_name>';
[379] Fix | Delete
echo '<wp:author_last_name>' . wxr_cdata( $author->last_name ) . '</wp:author_last_name>';
[380] Fix | Delete
echo "</wp:author>\n";
[381] Fix | Delete
}
[382] Fix | Delete
}
[383] Fix | Delete
[384] Fix | Delete
/**
[385] Fix | Delete
* Output all navigation menu terms
[386] Fix | Delete
*
[387] Fix | Delete
* @since 3.1.0
[388] Fix | Delete
*/
[389] Fix | Delete
function wxr_nav_menu_terms() {
[390] Fix | Delete
$nav_menus = wp_get_nav_menus();
[391] Fix | Delete
if ( empty( $nav_menus ) || ! is_array( $nav_menus ) ) {
[392] Fix | Delete
return;
[393] Fix | Delete
}
[394] Fix | Delete
[395] Fix | Delete
foreach ( $nav_menus as $menu ) {
[396] Fix | Delete
echo "\t<wp:term>";
[397] Fix | Delete
echo '<wp:term_id>' . (int) $menu->term_id . '</wp:term_id>';
[398] Fix | Delete
echo '<wp:term_taxonomy>nav_menu</wp:term_taxonomy>';
[399] Fix | Delete
echo '<wp:term_slug>' . wxr_cdata( $menu->slug ) . '</wp:term_slug>';
[400] Fix | Delete
wxr_term_name( $menu );
[401] Fix | Delete
echo "</wp:term>\n";
[402] Fix | Delete
}
[403] Fix | Delete
}
[404] Fix | Delete
[405] Fix | Delete
/**
[406] Fix | Delete
* Output list of taxonomy terms, in XML tag format, associated with a post
[407] Fix | Delete
*
[408] Fix | Delete
* @since 2.3.0
[409] Fix | Delete
*/
[410] Fix | Delete
function wxr_post_taxonomy() {
[411] Fix | Delete
$post = get_post();
[412] Fix | Delete
[413] Fix | Delete
$taxonomies = get_object_taxonomies( $post->post_type );
[414] Fix | Delete
if ( empty( $taxonomies ) ) {
[415] Fix | Delete
return;
[416] Fix | Delete
}
[417] Fix | Delete
$terms = wp_get_object_terms( $post->ID, $taxonomies );
[418] Fix | Delete
[419] Fix | Delete
foreach ( (array) $terms as $term ) {
[420] Fix | Delete
echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n";
[421] Fix | Delete
}
[422] Fix | Delete
}
[423] Fix | Delete
[424] Fix | Delete
/**
[425] Fix | Delete
* @param bool $return_me
[426] Fix | Delete
* @param string $meta_key
[427] Fix | Delete
* @return bool
[428] Fix | Delete
*/
[429] Fix | Delete
function wxr_filter_postmeta( $return_me, $meta_key ) {
[430] Fix | Delete
if ( '_edit_lock' === $meta_key ) {
[431] Fix | Delete
$return_me = true;
[432] Fix | Delete
}
[433] Fix | Delete
return $return_me;
[434] Fix | Delete
}
[435] Fix | Delete
add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 );
[436] Fix | Delete
[437] Fix | Delete
echo '<?xml version="1.0" encoding="' . get_bloginfo( 'charset' ) . "\" ?>\n";
[438] Fix | Delete
[439] Fix | Delete
?>
[440] Fix | Delete
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
[441] Fix | Delete
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
[442] Fix | Delete
<!-- You may use this file to transfer that content from one site to another. -->
[443] Fix | Delete
<!-- This file is not intended to serve as a complete backup of your site. -->
[444] Fix | Delete
[445] Fix | Delete
<!-- To import this information into a WordPress site follow these steps: -->
[446] Fix | Delete
<!-- 1. Log in to that site as an administrator. -->
[447] Fix | Delete
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
[448] Fix | Delete
<!-- 3. Install the "WordPress" importer from the list. -->
[449] Fix | Delete
<!-- 4. Activate & Run Importer. -->
[450] Fix | Delete
<!-- 5. Upload this file using the form provided on that page. -->
[451] Fix | Delete
<!-- 6. You will first be asked to map the authors in this export file to users -->
[452] Fix | Delete
<!-- on the site. For each author, you may choose to map to an -->
[453] Fix | Delete
<!-- existing user on the site or to create a new user. -->
[454] Fix | Delete
<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
[455] Fix | Delete
<!-- contained in this file into your site. -->
[456] Fix | Delete
[457] Fix | Delete
<?php the_generator( 'export' ); ?>
[458] Fix | Delete
<rss version="2.0"
[459] Fix | Delete
xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
[460] Fix | Delete
xmlns:content="http://purl.org/rss/1.0/modules/content/"
[461] Fix | Delete
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
[462] Fix | Delete
xmlns:dc="http://purl.org/dc/elements/1.1/"
[463] Fix | Delete
xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
[464] Fix | Delete
>
[465] Fix | Delete
[466] Fix | Delete
<channel>
[467] Fix | Delete
<title><?php bloginfo_rss( 'name' ); ?></title>
[468] Fix | Delete
<link><?php bloginfo_rss( 'url' ); ?></link>
[469] Fix | Delete
<description><?php bloginfo_rss( 'description' ); ?></description>
[470] Fix | Delete
<pubDate><?php echo gmdate( 'D, d M Y H:i:s +0000' ); ?></pubDate>
[471] Fix | Delete
<language><?php bloginfo_rss( 'language' ); ?></language>
[472] Fix | Delete
<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
[473] Fix | Delete
<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
[474] Fix | Delete
<wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
[475] Fix | Delete
[476] Fix | Delete
<?php wxr_authors_list( $post_ids ); ?>
[477] Fix | Delete
[478] Fix | Delete
<?php foreach ( $cats as $c ) : ?>
[479] Fix | Delete
<wp:category>
[480] Fix | Delete
<wp:term_id><?php echo (int) $c->term_id; ?></wp:term_id>
[481] Fix | Delete
<wp:category_nicename><?php echo wxr_cdata( $c->slug ); ?></wp:category_nicename>
[482] Fix | Delete
<wp:category_parent><?php echo wxr_cdata( $c->parent ? $cats[ $c->parent ]->slug : '' ); ?></wp:category_parent>
[483] Fix | Delete
<?php
[484] Fix | Delete
wxr_cat_name( $c );
[485] Fix | Delete
wxr_category_description( $c );
[486] Fix | Delete
wxr_term_meta( $c );
[487] Fix | Delete
?>
[488] Fix | Delete
</wp:category>
[489] Fix | Delete
<?php endforeach; ?>
[490] Fix | Delete
<?php foreach ( $tags as $t ) : ?>
[491] Fix | Delete
<wp:tag>
[492] Fix | Delete
<wp:term_id><?php echo (int) $t->term_id; ?></wp:term_id>
[493] Fix | Delete
<wp:tag_slug><?php echo wxr_cdata( $t->slug ); ?></wp:tag_slug>
[494] Fix | Delete
<?php
[495] Fix | Delete
wxr_tag_name( $t );
[496] Fix | Delete
wxr_tag_description( $t );
[497] Fix | Delete
wxr_term_meta( $t );
[498] Fix | Delete
?>
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function