Make WordPress Core

Changeset 57786


Ignore:
Timestamp:
03/07/2024 05:56:49 AM (7 weeks ago)
Author:
desrosj
Message:

Upload: Add links back to installer pages.

This adds a link back to the plugin or theme installers when an incompatible archive error message is encountered.

Props Presskopp, swissspidy, smub, pmbaldha, aneeshd16.
Fixes #60578.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-file-upload-upgrader.php

    r57537 r57786  
    7373                if ( ! wp_zip_file_is_valid( $file['file'] ) ) {
    7474                    wp_delete_file( $file['file'] );
    75                     wp_die( __( 'Incompatible Archive.' ) );
     75
     76                    if ( 'pluginzip' === $form ) {
     77                        $plugins_page = sprintf(
     78                            '<a href="%s">%s</a>',
     79                            self_admin_url( 'plugin-install.php' ),
     80                            __( 'Return to the Plugin Installer' )
     81                        );
     82                        wp_die( __( 'Incompatible Archive.' ) . '<br />' . $plugins_page );
     83                    }
     84
     85                    if ( 'themezip' === $form ) {
     86                        $themes_page = sprintf(
     87                            '<a href="%s" target="_parent">%s</a>',
     88                            self_admin_url( 'theme-install.php' ),
     89                            __( 'Return to the Theme Installer' )
     90                        );
     91                        wp_die( __( 'Incompatible Archive.' ) . '<br />' . $themes_page );
     92                    }
    7693                }
    7794            }
Note: See TracChangeset for help on using the changeset viewer.