General: Error messages improvements in /wp-includes files.

This changeset improves a bunch of 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.
Fixes #43622.



Built from https://develop.svn.wordpress.org/trunk@59790


git-svn-id: http://core.svn.wordpress.org/trunk@59132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2025-02-08 16:00:19 +00:00
parent c5293a0be9
commit 6309ca8f17
6 changed files with 17 additions and 9 deletions

View File

@ -454,7 +454,7 @@ final class WP_Customize_Manager {
} }
if ( ! $message ) { if ( ! $message ) {
$message = __( 'Something went wrong.' ); $message = __( 'An error occurred while customizing. Please refresh the page and try again.' );
} }
if ( $this->messenger_channel ) { if ( $this->messenger_channel ) {

View File

@ -4031,7 +4031,7 @@ class wp_xmlrpc_server extends IXR_Server {
} }
if ( ! $comment_id ) { if ( ! $comment_id ) {
return new IXR_Error( 403, __( 'Something went wrong.' ) ); return new IXR_Error( 403, __( 'An error occurred while processing your comment. Please ensure all fields are filled correctly and try again.' ) );
} }
/** /**
@ -5051,7 +5051,7 @@ class wp_xmlrpc_server extends IXR_Server {
$posts_list = wp_get_recent_posts( $query ); $posts_list = wp_get_recent_posts( $query );
if ( ! $posts_list ) { if ( ! $posts_list ) {
$this->error = new IXR_Error( 500, __( 'Either there are no posts, or something went wrong.' ) ); $this->error = new IXR_Error( 500, __( 'No posts found or an error occurred while retrieving posts.' ) );
return $this->error; return $this->error;
} }
@ -6584,7 +6584,7 @@ class wp_xmlrpc_server extends IXR_Server {
$posts_list = wp_get_recent_posts( $query ); $posts_list = wp_get_recent_posts( $query );
if ( ! $posts_list ) { if ( ! $posts_list ) {
$this->error = new IXR_Error( 500, __( 'Either there are no posts, or something went wrong.' ) ); $this->error = new IXR_Error( 500, __( 'No posts found or an error occurred while retrieving posts.' ) );
return $this->error; return $this->error;
} }

View File

@ -3672,7 +3672,7 @@ function get_allowed_mime_types( $user = null ) {
*/ */
function wp_nonce_ays( $action ) { function wp_nonce_ays( $action ) {
// Default title and response code. // Default title and response code.
$title = __( 'Something went wrong.' ); $title = __( 'An error occurred.' );
$response_code = 403; $response_code = 403;
if ( 'log-out' === $action ) { if ( 'log-out' === $action ) {

View File

@ -810,7 +810,7 @@ function wp_default_scripts( $scripts ) {
'wpAjax', 'wpAjax',
array( array(
'noPerm' => __( 'Sorry, you are not allowed to do that.' ), 'noPerm' => __( 'Sorry, you are not allowed to do that.' ),
'broken' => __( 'Something went wrong.' ), 'broken' => __( 'An error occurred while processing your request. Please try again later.' ),
) )
); );
@ -1292,7 +1292,7 @@ function wp_default_scripts( $scripts ) {
'close' => __( 'Close' ), 'close' => __( 'Close' ),
'action' => __( 'Action' ), 'action' => __( 'Action' ),
'discardChanges' => __( 'Discard changes' ), 'discardChanges' => __( 'Discard changes' ),
'cheatin' => __( 'Something went wrong.' ), 'cheatin' => __( 'An error occurred. Please try again later.' ),
'notAllowedHeading' => __( 'You need a higher level of permission.' ), 'notAllowedHeading' => __( 'You need a higher level of permission.' ),
'notAllowed' => __( 'Sorry, you are not allowed to customize this site.' ), 'notAllowed' => __( 'Sorry, you are not allowed to customize this site.' ),
'previewIframeTitle' => __( 'Site Preview' ), 'previewIframeTitle' => __( 'Site Preview' ),

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.8-alpha-59789'; $wp_version = '6.8-alpha-59790';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -39,7 +39,15 @@ if ( ! defined( 'WP_MAIL_INTERVAL' ) ) {
$last_checked = get_transient( 'mailserver_last_checked' ); $last_checked = get_transient( 'mailserver_last_checked' );
if ( $last_checked ) { if ( $last_checked ) {
wp_die( __( 'Slow down cowboy, no need to check for new mails so often!' ) ); wp_die(
sprintf(
// translators: %s human readable rate limit.
__( 'Email checks are rate limited to once every %s.' ),
human_time_diff( time() - WP_MAIL_INTERVAL, time() )
),
__( 'Slow down, no need to check for new mails so often!' ),
429
);
} }
set_transient( 'mailserver_last_checked', true, WP_MAIL_INTERVAL ); set_transient( 'mailserver_last_checked', true, WP_MAIL_INTERVAL );