I maintain a bunch of different WordPress sites, and I have noticed a wide variety of default filenames for the XML content export file (Tools-Export-all content). Some of them even use a PHP extension for the downloaded XML file.

How can I set or define the name of the export.xml file? Thanks!

1 Answer 1


By default, the filename is defined in /wp-admin/includes/export.php:

$sitename = sanitize_key( get_bloginfo( 'name' ) );
if ( ! empty( $sitename ) ) {
    $sitename .= '.';
$date        = gmdate( 'Y-m-d' );
$wp_filename = $sitename . 'WordPress.' . $date . '.xml';

And you can filter it:

$filename = apply_filters( 'export_wp_filename', $wp_filename, $sitename, $date );

So you could make a plugin and add a filter there:

    function( $wp_filename, $sitename, $date )
        // do something here, and then return a string
    }, 10, 3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.