Skip to content

Commit

Permalink
Administration: Error messages improvements in WP Admin.
Browse files Browse the repository at this point in the history
This changeset improves a bunch of WP-Admin error messages, notably replacing the good old cryptic "Something went wrong" message with more helpful information.

Props peterwilsoncc, netweb, karmatosed, JoshuaWold, mrtortai, audrasjb, sukhendu2002, joedolson.
See #43622.




git-svn-id: https://develop.svn.wordpress.org/trunk@59789 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
audrasjb committed Feb 8, 2025
1 parent fc8fa6a commit 3428f3a
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/js/_enqueues/admin/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jQuery( function($) {
tr.children().css('backgroundColor', '');

} else {
$('#ajax-response').empty().append('<div class="error"><p>' + wp.i18n.__( 'Something went wrong.' ) + '</p></div>');
$('#ajax-response').empty().append('<div class="error"><p>' + wp.i18n.__( 'An error occurred while processing your request. Please try again later.' ) + '</p></div>');
tr.children().css('backgroundColor', '');
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/js/_enqueues/lib/ajax-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ window.wpAjax = jQuery.extend( {
selector = jQuery( selector );
return !wpAjax.invalidateForm( selector.find('.form-required').filter( function() { return jQuery('input:visible', this).val() === ''; } ) ).length;
}
}, wpAjax || { noPerm: 'Sorry, you are not allowed to do that.', broken: 'Something went wrong.' } );
}, wpAjax || { noPerm: 'Sorry, you are not allowed to do that.', broken: 'An error occurred while processing your request. Please refresh the page and try again.' } );

// Basic form validation.
jQuery( function($){
Expand Down
2 changes: 1 addition & 1 deletion src/js/_enqueues/wp/theme-plugin-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ wp.themePluginEditor = (function( $ ) {
var notice = $.extend(
{
code: 'save_error',
message: __( 'Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP.' )
message: __( 'An error occurred while saving your changes. Please try again. If the problem persists, you may need to manually update the file via FTP.' )
},
response,
{
Expand Down
2 changes: 1 addition & 1 deletion src/js/_enqueues/wp/updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -2333,7 +2333,7 @@
* 'update' or 'install'.
*/
wp.updates.isValidResponse = function( response, action ) {
var error = __( 'Something went wrong.' ),
var error = __( 'An error occurred during the update process. Please try again.' ),
errorMessage;

// Make sure the response is a valid data object and not a Promise object.
Expand Down
4 changes: 2 additions & 2 deletions src/wp-admin/customize.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@

if ( in_array( get_post_status( $changeset_post->ID ), array( 'publish', 'trash' ), true ) ) {
wp_die(
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'This changeset cannot be further modified.' ) . '</p>' .
'<h1>' . __( 'An error occurred while saving your changeset.' ) . '</h1>' .
'<p>' . __( 'Please try again or start a new changeset. This changeset cannot be further modified.' ) . '</p>' .
'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>',
403
);
Expand Down
10 changes: 5 additions & 5 deletions src/wp-admin/includes/class-custom-image-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,8 @@ public function step_2() {

if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
wp_die(
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'The active theme does not support uploading a custom header image.' ) . '</p>',
'<h1>' . __( 'An error occurred while processing your header image.' ) . '</h1>' .
'<p>' . __( 'The active theme does not support uploading a custom header image. Please ensure your theme supports custom headers and try again.' ) . '</p>',
403
);
}
Expand Down Expand Up @@ -1018,8 +1018,8 @@ public function step_3() {

if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
wp_die(
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'The active theme does not support uploading a custom header image.' ) . '</p>',
'<h1>' . __( 'An error occurred while processing your header image.' ) . '</h1>' .
'<p>' . __( 'The active theme does not support uploading a custom header image. Please ensure your theme supports custom headers and try again.' ) . '</p>',
403
);
}
Expand All @@ -1029,7 +1029,7 @@ public function step_3() {
&& ! current_theme_supports( 'custom-header', 'flex-width' )
) {
wp_die(
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<h1>' . __( 'An error occurred while processing your header image.' ) . '</h1>' .
'<p>' . __( 'The active theme does not support a flexible sized header image.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ function wp_edit_theme_plugin_file( $args ) {
wp_opcache_invalidate( $real_file, true );

if ( ! isset( $result['message'] ) ) {
$message = __( 'Something went wrong.' );
$message = __( 'An error occurred. Please try again later.' );
} else {
$message = $result['message'];
unset( $result['message'] );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/revision.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ function wp_print_revision_templates() {

<script id="tmpl-revisions-diff" type="text/html">
<div class="loading-indicator"><span class="spinner"></span></div>
<div class="diff-error"><?php _e( 'Sorry, something went wrong. The requested comparison could not be loaded.' ); ?></div>
<div class="diff-error"><?php _e( 'An error occurred while loading the comparison. Please refresh the page and try again.' ); ?></div>
<div class="diff">
<# _.each( data.fields, function( field ) { #>
<h2>{{ field.name }}</h2>
Expand Down
4 changes: 2 additions & 2 deletions src/wp-admin/media-upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
// Require an ID for the edit screen.
if ( isset( $action ) && 'edit' === $action && ! $ID ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
wp_die(
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<p>' . __( 'Invalid item ID.' ) . '</p>',
'<h1>' . __( 'An error occurred during the upload process.' ) . '</h1>' .
'<p>' . __( 'Invalid item ID. You can view all media items in the <a href="upload.php">Media Library</a>.' ) . '</p>',
403
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/network/site-users.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
// If the user doesn't already belong to the blog, bail.
if ( ! is_user_member_of_blog( $user_id ) ) {
wp_die(
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<h1>' . __( 'An error occurred.' ) . '</h1>' .
'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
403
);
Expand Down
4 changes: 2 additions & 2 deletions src/wp-admin/themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

if ( ! $theme->exists() || ! $theme->is_allowed() ) {
wp_die(
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<h1>' . __( 'An error occurred.' ) . '</h1>' .
'<p>' . __( 'The requested theme does not exist.' ) . '</p>',
403
);
Expand Down Expand Up @@ -67,7 +67,7 @@

if ( ! $theme->exists() ) {
wp_die(
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<h1>' . __( 'An error occurred while deleting the theme.' ) . '</h1>' .
'<p>' . __( 'The requested theme does not exist.' ) . '</p>',
403
);
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
// If the user doesn't already belong to the blog, bail.
if ( is_multisite() && ! is_user_member_of_blog( $id ) ) {
wp_die(
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
'<h1>' . __( 'An error occurred.' ) . '</h1>' .
'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
403
);
Expand Down

0 comments on commit 3428f3a

Please sign in to comment.