Edit File by line
/home/zeestwma/redstone.../wp-admin...
File: export.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WordPress Export Administration Screen
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/** Load WordPress Bootstrap */
[8] Fix | Delete
require_once __DIR__ . '/admin.php';
[9] Fix | Delete
[10] Fix | Delete
if ( ! current_user_can( 'export' ) ) {
[11] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to export the content of this site.' ) );
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
/** Load WordPress export API */
[15] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/export.php';
[16] Fix | Delete
[17] Fix | Delete
// Used in the HTML title tag.
[18] Fix | Delete
$title = __( 'Export' );
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Display JavaScript on the page.
[22] Fix | Delete
*
[23] Fix | Delete
* @since 3.5.0
[24] Fix | Delete
*/
[25] Fix | Delete
[26] Fix | Delete
[27] Fix | Delete
get_current_screen()->add_help_tab(
[28] Fix | Delete
array(
[29] Fix | Delete
'id' => 'overview',
[30] Fix | Delete
'title' => __( 'Overview' ),
[31] Fix | Delete
'content' => '<p>' . __( 'You can export a file of your site&#8217;s content in order to import it into another installation or platform. The export file will be an XML file format called WXR. Posts, pages, comments, custom fields, categories, and tags can be included. You can choose for the WXR file to include only certain posts or pages by setting the dropdown filters to limit the export by category, author, date range by month, or publishing status.' ) . '</p>' .
[32] Fix | Delete
'<p>' . __( 'Once generated, your WXR file can be imported by another WordPress site or by another blogging platform able to access this format.' ) . '</p>',
[33] Fix | Delete
)
[34] Fix | Delete
);
[35] Fix | Delete
[36] Fix | Delete
get_current_screen()->set_help_sidebar(
[37] Fix | Delete
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
[38] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/documentation/article/tools-export-screen/">Documentation on Export</a>' ) . '</p>' .
[39] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
[40] Fix | Delete
);
[41] Fix | Delete
[42] Fix | Delete
// If the 'download' URL parameter is set, a WXR export file is baked and returned.
[43] Fix | Delete
if ( isset( $_GET['download'] ) ) {
[44] Fix | Delete
$args = array();
[45] Fix | Delete
[46] Fix | Delete
if ( ! isset( $_GET['content'] ) || 'all' === $_GET['content'] ) {
[47] Fix | Delete
$args['content'] = 'all';
[48] Fix | Delete
} elseif ( 'posts' === $_GET['content'] ) {
[49] Fix | Delete
$args['content'] = 'post';
[50] Fix | Delete
[51] Fix | Delete
if ( $_GET['cat'] ) {
[52] Fix | Delete
$args['category'] = (int) $_GET['cat'];
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
if ( $_GET['post_author'] ) {
[56] Fix | Delete
$args['author'] = (int) $_GET['post_author'];
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
if ( $_GET['post_start_date'] || $_GET['post_end_date'] ) {
[60] Fix | Delete
$args['start_date'] = $_GET['post_start_date'];
[61] Fix | Delete
$args['end_date'] = $_GET['post_end_date'];
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
if ( $_GET['post_status'] ) {
[65] Fix | Delete
$args['status'] = $_GET['post_status'];
[66] Fix | Delete
}
[67] Fix | Delete
} elseif ( 'pages' === $_GET['content'] ) {
[68] Fix | Delete
$args['content'] = 'page';
[69] Fix | Delete
[70] Fix | Delete
if ( $_GET['page_author'] ) {
[71] Fix | Delete
$args['author'] = (int) $_GET['page_author'];
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
if ( $_GET['page_start_date'] || $_GET['page_end_date'] ) {
[75] Fix | Delete
$args['start_date'] = $_GET['page_start_date'];
[76] Fix | Delete
$args['end_date'] = $_GET['page_end_date'];
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
if ( $_GET['page_status'] ) {
[80] Fix | Delete
$args['status'] = $_GET['page_status'];
[81] Fix | Delete
}
[82] Fix | Delete
} elseif ( 'attachment' === $_GET['content'] ) {
[83] Fix | Delete
$args['content'] = 'attachment';
[84] Fix | Delete
[85] Fix | Delete
if ( $_GET['attachment_start_date'] || $_GET['attachment_end_date'] ) {
[86] Fix | Delete
$args['start_date'] = $_GET['attachment_start_date'];
[87] Fix | Delete
$args['end_date'] = $_GET['attachment_end_date'];
[88] Fix | Delete
}
[89] Fix | Delete
} else {
[90] Fix | Delete
$args['content'] = $_GET['content'];
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
/**
[94] Fix | Delete
* Filters the export args.
[95] Fix | Delete
*
[96] Fix | Delete
* @since 3.5.0
[97] Fix | Delete
*
[98] Fix | Delete
* @param array $args The arguments to send to the exporter.
[99] Fix | Delete
*/
[100] Fix | Delete
$args = apply_filters( 'export_args', $args );
[101] Fix | Delete
[102] Fix | Delete
export_wp( $args );
[103] Fix | Delete
die();
[104] Fix | Delete
}
[105] Fix | Delete
[106] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[107] Fix | Delete
[108] Fix | Delete
/**
[109] Fix | Delete
* Creates the date options fields for exporting a given post type.
[110] Fix | Delete
*
[111] Fix | Delete
* @since 3.1.0
[112] Fix | Delete
*
[113] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[114] Fix | Delete
* @global WP_Locale $wp_locale WordPress date and time locale object.
[115] Fix | Delete
*
[116] Fix | Delete
* @param string $post_type The post type. Default 'post'.
[117] Fix | Delete
*/
[118] Fix | Delete
function export_date_options( $post_type = 'post' ) {
[119] Fix | Delete
global $wpdb, $wp_locale;
[120] Fix | Delete
[121] Fix | Delete
$months = $wpdb->get_results(
[122] Fix | Delete
$wpdb->prepare(
[123] Fix | Delete
"SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
[124] Fix | Delete
FROM $wpdb->posts
[125] Fix | Delete
WHERE post_type = %s AND post_status != 'auto-draft'
[126] Fix | Delete
ORDER BY post_date DESC",
[127] Fix | Delete
$post_type
[128] Fix | Delete
)
[129] Fix | Delete
);
[130] Fix | Delete
[131] Fix | Delete
$month_count = count( $months );
[132] Fix | Delete
if ( ! $month_count || ( 1 === $month_count && 0 === (int) $months[0]->month ) ) {
[133] Fix | Delete
return;
[134] Fix | Delete
}
[135] Fix | Delete
[136] Fix | Delete
foreach ( $months as $date ) {
[137] Fix | Delete
if ( 0 === (int) $date->year ) {
[138] Fix | Delete
continue;
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
$month = zeroise( $date->month, 2 );
[142] Fix | Delete
[143] Fix | Delete
printf(
[144] Fix | Delete
'<option value="%1$s">%2$s</option>',
[145] Fix | Delete
esc_attr( $date->year . '-' . $month ),
[146] Fix | Delete
$wp_locale->get_month( $month ) . ' ' . $date->year
[147] Fix | Delete
);
[148] Fix | Delete
}
[149] Fix | Delete
}
[150] Fix | Delete
?>
[151] Fix | Delete
[152] Fix | Delete
<div class="wrap">
[153] Fix | Delete
<h1><?php echo esc_html( $title ); ?></h1>
[154] Fix | Delete
[155] Fix | Delete
<p><?php _e( 'When you click the button below WordPress will create an XML file for you to save to your computer.' ); ?></p>
[156] Fix | Delete
<p><?php _e( 'This format, which is called WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.' ); ?></p>
[157] Fix | Delete
<p><?php _e( 'Once you&#8217;ve saved the download file, you can use the Import function in another WordPress installation to import the content from this site.' ); ?></p>
[158] Fix | Delete
[159] Fix | Delete
<h2><?php _e( 'Choose what to export' ); ?></h2>
[160] Fix | Delete
<form method="get" id="export-filters">
[161] Fix | Delete
<fieldset>
[162] Fix | Delete
<legend class="screen-reader-text">
[163] Fix | Delete
<?php
[164] Fix | Delete
/* translators: Hidden accessibility text. */
[165] Fix | Delete
_e( 'Content to export' );
[166] Fix | Delete
?>
[167] Fix | Delete
</legend>
[168] Fix | Delete
<input type="hidden" name="download" value="true" />
[169] Fix | Delete
<p><label><input type="radio" name="content" value="all" checked="checked" aria-describedby="all-content-desc" /> <?php _e( 'All content' ); ?></label></p>
[170] Fix | Delete
<p class="description" id="all-content-desc"><?php _e( 'This will contain all of your posts, pages, comments, custom fields, terms, navigation menus, and custom posts.' ); ?></p>
[171] Fix | Delete
[172] Fix | Delete
<p><label><input type="radio" name="content" value="posts" /> <?php _ex( 'Posts', 'post type general name' ); ?></label></p>
[173] Fix | Delete
<ul id="post-filters" class="export-filters">
[174] Fix | Delete
<li>
[175] Fix | Delete
<label><span class="label-responsive"><?php _e( 'Categories:' ); ?></span>
[176] Fix | Delete
<?php wp_dropdown_categories( array( 'show_option_all' => __( 'All' ) ) ); ?>
[177] Fix | Delete
</label>
[178] Fix | Delete
</li>
[179] Fix | Delete
<li>
[180] Fix | Delete
<label><span class="label-responsive"><?php _e( 'Authors:' ); ?></span>
[181] Fix | Delete
<?php
[182] Fix | Delete
$authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'post'" );
[183] Fix | Delete
wp_dropdown_users(
[184] Fix | Delete
array(
[185] Fix | Delete
'include' => $authors,
[186] Fix | Delete
'name' => 'post_author',
[187] Fix | Delete
'multi' => true,
[188] Fix | Delete
'show_option_all' => __( 'All' ),
[189] Fix | Delete
'show' => 'display_name_with_login',
[190] Fix | Delete
)
[191] Fix | Delete
);
[192] Fix | Delete
?>
[193] Fix | Delete
</label>
[194] Fix | Delete
</li>
[195] Fix | Delete
<li>
[196] Fix | Delete
<fieldset>
[197] Fix | Delete
<legend class="screen-reader-text">
[198] Fix | Delete
<?php
[199] Fix | Delete
/* translators: Hidden accessibility text. */
[200] Fix | Delete
_e( 'Date range:' )
[201] Fix | Delete
?>
[202] Fix | Delete
</legend>
[203] Fix | Delete
<label for="post-start-date" class="label-responsive"><?php _e( 'Start date:' ); ?></label>
[204] Fix | Delete
<select name="post_start_date" id="post-start-date">
[205] Fix | Delete
<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
[206] Fix | Delete
<?php export_date_options(); ?>
[207] Fix | Delete
</select>
[208] Fix | Delete
<label for="post-end-date" class="label-responsive"><?php _e( 'End date:' ); ?></label>
[209] Fix | Delete
<select name="post_end_date" id="post-end-date">
[210] Fix | Delete
<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
[211] Fix | Delete
<?php export_date_options(); ?>
[212] Fix | Delete
</select>
[213] Fix | Delete
</fieldset>
[214] Fix | Delete
</li>
[215] Fix | Delete
<li>
[216] Fix | Delete
<label for="post-status" class="label-responsive"><?php _e( 'Status:' ); ?></label>
[217] Fix | Delete
<select name="post_status" id="post-status">
[218] Fix | Delete
<option value="0"><?php _e( 'All' ); ?></option>
[219] Fix | Delete
<?php
[220] Fix | Delete
$post_statuses = get_post_stati( array( 'internal' => false ), 'objects' );
[221] Fix | Delete
foreach ( $post_statuses as $status ) :
[222] Fix | Delete
?>
[223] Fix | Delete
<option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
[224] Fix | Delete
<?php endforeach; ?>
[225] Fix | Delete
</select>
[226] Fix | Delete
</li>
[227] Fix | Delete
</ul>
[228] Fix | Delete
[229] Fix | Delete
<p><label><input type="radio" name="content" value="pages" /> <?php _e( 'Pages' ); ?></label></p>
[230] Fix | Delete
<ul id="page-filters" class="export-filters">
[231] Fix | Delete
<li>
[232] Fix | Delete
<label><span class="label-responsive"><?php _e( 'Authors:' ); ?></span>
[233] Fix | Delete
<?php
[234] Fix | Delete
$authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'page'" );
[235] Fix | Delete
wp_dropdown_users(
[236] Fix | Delete
array(
[237] Fix | Delete
'include' => $authors,
[238] Fix | Delete
'name' => 'page_author',
[239] Fix | Delete
'multi' => true,
[240] Fix | Delete
'show_option_all' => __( 'All' ),
[241] Fix | Delete
'show' => 'display_name_with_login',
[242] Fix | Delete
)
[243] Fix | Delete
);
[244] Fix | Delete
?>
[245] Fix | Delete
</label>
[246] Fix | Delete
</li>
[247] Fix | Delete
<li>
[248] Fix | Delete
<fieldset>
[249] Fix | Delete
<legend class="screen-reader-text">
[250] Fix | Delete
<?php
[251] Fix | Delete
/* translators: Hidden accessibility text. */
[252] Fix | Delete
_e( 'Date range:' );
[253] Fix | Delete
?>
[254] Fix | Delete
</legend>
[255] Fix | Delete
<label for="page-start-date" class="label-responsive"><?php _e( 'Start date:' ); ?></label>
[256] Fix | Delete
<select name="page_start_date" id="page-start-date">
[257] Fix | Delete
<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
[258] Fix | Delete
<?php export_date_options( 'page' ); ?>
[259] Fix | Delete
</select>
[260] Fix | Delete
<label for="page-end-date" class="label-responsive"><?php _e( 'End date:' ); ?></label>
[261] Fix | Delete
<select name="page_end_date" id="page-end-date">
[262] Fix | Delete
<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
[263] Fix | Delete
<?php export_date_options( 'page' ); ?>
[264] Fix | Delete
</select>
[265] Fix | Delete
</fieldset>
[266] Fix | Delete
</li>
[267] Fix | Delete
<li>
[268] Fix | Delete
<label for="page-status" class="label-responsive"><?php _e( 'Status:' ); ?></label>
[269] Fix | Delete
<select name="page_status" id="page-status">
[270] Fix | Delete
<option value="0"><?php _e( 'All' ); ?></option>
[271] Fix | Delete
<?php foreach ( $post_statuses as $status ) : ?>
[272] Fix | Delete
<option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
[273] Fix | Delete
<?php endforeach; ?>
[274] Fix | Delete
</select>
[275] Fix | Delete
</li>
[276] Fix | Delete
</ul>
[277] Fix | Delete
[278] Fix | Delete
<?php
[279] Fix | Delete
foreach ( get_post_types(
[280] Fix | Delete
array(
[281] Fix | Delete
'_builtin' => false,
[282] Fix | Delete
'can_export' => true,
[283] Fix | Delete
),
[284] Fix | Delete
'objects'
[285] Fix | Delete
) as $post_type ) :
[286] Fix | Delete
?>
[287] Fix | Delete
<p><label><input type="radio" name="content" value="<?php echo esc_attr( $post_type->name ); ?>" /> <?php echo esc_html( $post_type->label ); ?></label></p>
[288] Fix | Delete
<?php endforeach; ?>
[289] Fix | Delete
[290] Fix | Delete
<p><label><input type="radio" name="content" value="attachment" /> <?php _e( 'Media' ); ?></label></p>
[291] Fix | Delete
<ul id="attachment-filters" class="export-filters">
[292] Fix | Delete
<li>
[293] Fix | Delete
<fieldset>
[294] Fix | Delete
<legend class="screen-reader-text">
[295] Fix | Delete
<?php
[296] Fix | Delete
/* translators: Hidden accessibility text. */
[297] Fix | Delete
_e( 'Date range:' );
[298] Fix | Delete
?>
[299] Fix | Delete
</legend>
[300] Fix | Delete
<label for="attachment-start-date" class="label-responsive"><?php _e( 'Start date:' ); ?></label>
[301] Fix | Delete
<select name="attachment_start_date" id="attachment-start-date">
[302] Fix | Delete
<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
[303] Fix | Delete
<?php export_date_options( 'attachment' ); ?>
[304] Fix | Delete
</select>
[305] Fix | Delete
<label for="attachment-end-date" class="label-responsive"><?php _e( 'End date:' ); ?></label>
[306] Fix | Delete
<select name="attachment_end_date" id="attachment-end-date">
[307] Fix | Delete
<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
[308] Fix | Delete
<?php export_date_options( 'attachment' ); ?>
[309] Fix | Delete
</select>
[310] Fix | Delete
</fieldset>
[311] Fix | Delete
</li>
[312] Fix | Delete
</ul>
[313] Fix | Delete
[314] Fix | Delete
</fieldset>
[315] Fix | Delete
<?php
[316] Fix | Delete
/**
[317] Fix | Delete
* Fires at the end of the export filters form.
[318] Fix | Delete
*
[319] Fix | Delete
* @since 3.5.0
[320] Fix | Delete
*/
[321] Fix | Delete
do_action( 'export_filters' );
[322] Fix | Delete
?>
[323] Fix | Delete
[324] Fix | Delete
<?php submit_button( __( 'Download Export File' ) ); ?>
[325] Fix | Delete
</form>
[326] Fix | Delete
</div>
[327] Fix | Delete
[328] Fix | Delete
<?php require_once ABSPATH . 'wp-admin/admin-footer.php'; ?>
[329] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function