WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#31808 closed defect (bug) (fixed)

Press This: unhelpful error message on post save failure.

Reported by: stephdau Owned by: SergeyBiryukov
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.2
Component: Press This Keywords: has-patch
Focuses: Cc:
PR Number:

Description (last modified by stephdau)

We use a generic error message when we fail to save the post, which can be due something as simple as not having post title and content: https://cloudup.com/c9uxsiqQOIU

if ( is_wp_error( $updated ) || intval( $updated ) < 1 ) {
	wp_send_json_error( array( 'errorMessage' => __( 'Error while saving the post. Please try again later.' ) ) );
} else {

We should instead use $updated->get_error_message() to let the user know exactly what happened: https://cloudup.com/cT5H53fr5Ic

See attached patch.

Originally reported here: https://wordpress.slack.com/archives/core-pressthis/p1427516975000306

Attachments (1)

31808.diff (713 bytes) - added by stephdau 5 years ago.

Download all attachments as: .zip

Change History (3)

@stephdau
5 years ago

#1 @stephdau
5 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
5 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 31930:

Press This: Use the error message returned by wp_update_post() instead of a generic one.

props stephdau.
fixes #31808.

Note: See TracTickets for help on using tickets.