diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index b63d241f92..ecddb5b96b 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -43,17 +43,19 @@ function current_theme_info() { * @since 2.8.0 * * @param string $template Template directory of the theme to delete + * @param string $redirect Redirect to page when complete. * @return mixed */ -function delete_theme($template) { +function delete_theme($template, $redirect = '') { global $wp_filesystem; if ( empty($template) ) return false; ob_start(); - $url = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template); - if ( false === ($credentials = request_filesystem_credentials($url)) ) { + if ( empty( $redirect ) ) + $redirect = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template); + if ( false === ($credentials = request_filesystem_credentials($redirect)) ) { $data = ob_get_contents(); ob_end_clean(); if ( ! empty($data) ){ diff --git a/wp-admin/network/themes.php b/wp-admin/network/themes.php index 728a3a9dd6..ade1c1d772 100644 --- a/wp-admin/network/themes.php +++ b/wp-admin/network/themes.php @@ -160,7 +160,7 @@ if ( $action ) { } // Endif verify-delete foreach ( $themes as $theme ) - $delete_result = delete_theme( $theme ); + $delete_result = delete_theme( $theme, esc_url( add_query_arg( array('verify-delete' => 1), $_SERVER['REQUEST_URI'] ) ) ); wp_redirect( add_query_arg( 'deleted', count( $themes ), $referer ) ); exit; break;