Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#31808 closed defect (bug) (fixed)

Press This: unhelpful error message on post save failure.

Reported by: stephdau's profile stephdau Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.2
Component: Press This Keywords: has-patch
Focuses: Cc:

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:

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:

See attached patch.

Originally reported here:

Attachments (1)

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

Download all attachments as: .zip

Change History (3)

9 years ago

#1 @stephdau
9 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
9 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.