From 750c22abf871e2966439718a4a83053ef486d3fb Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 19 Sep 2015 17:43:52 +0000 Subject: [PATCH] Export: Add a filer, `'export_wp_filename'` to change the filename of the file to download when exporting. Props MikeHansenMe, wonderboymusic. Fixes #29500. git-svn-id: https://develop.svn.wordpress.org/trunk@34327 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/export.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php index 4fcf253306..3acd7fdc3e 100644 --- a/src/wp-admin/includes/export.php +++ b/src/wp-admin/includes/export.php @@ -43,8 +43,21 @@ function export_wp( $args = array() ) { do_action( 'export_wp', $args ); $sitename = sanitize_key( get_bloginfo( 'name' ) ); - if ( ! empty($sitename) ) $sitename .= '.'; - $filename = $sitename . 'wordpress.' . date( 'Y-m-d' ) . '.xml'; + if ( ! empty( $sitename ) ) { + $sitename .= '.'; + } + $date = date( 'Y-m-d' ); + $wp_filename = $sitename . 'wordpress.' . $date . '.xml'; + /** + * Filter the export filename. + * + * @since 4.4.0 + * + * @param string $wp_filename The name of the file for download. + * @param string $sitename The site name. + * @param string $date Today's date, formatted. + */ + $filename = apply_filters( 'export_wp_filename', $wp_filename, $sitename, $date ); header( 'Content-Description: File Transfer' ); header( 'Content-Disposition: attachment; filename=' . $filename );