WordPress.org

Make WordPress Core

Ticket #16117: 16117.diff

File 16117.diff, 1.6 KB (added by ryan, 2 years ago)

Fix redirect after connection information

  • wp-admin/includes/theme.php

     
    4343 * @since 2.8.0 
    4444 * 
    4545 * @param string $template Template directory of the theme to delete 
     46 * @param string $redirect Redirect to page when complete. 
    4647 * @return mixed 
    4748 */ 
    48 function delete_theme($template) { 
     49function delete_theme($template, $redirect = '') { 
    4950        global $wp_filesystem; 
    5051 
    5152        if ( empty($template) ) 
    5253                return false; 
    5354 
    5455        ob_start(); 
    55         $url = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template); 
    56         if ( false === ($credentials = request_filesystem_credentials($url)) ) { 
     56        if ( empty( $redirect ) ) 
     57                $redirect = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template); 
     58        if ( false === ($credentials = request_filesystem_credentials($redirect)) ) { 
    5759                $data = ob_get_contents(); 
    5860                ob_end_clean(); 
    5961                if ( ! empty($data) ){ 
  • wp-admin/network/themes.php

     
    160160                        } // Endif verify-delete 
    161161 
    162162                        foreach ( $themes as $theme ) 
    163                                 $delete_result = delete_theme( $theme ); 
     163                                $delete_result = delete_theme( $theme, esc_url( add_query_arg( array('verify-delete' => 1), $_SERVER['REQUEST_URI'] ) ) ); 
    164164                        wp_redirect( add_query_arg( 'deleted', count( $themes ), $referer ) ); 
    165165                        exit; 
    166166                        break;