Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#5166 closed defect (bug) (invalid)

use wp_die instead of echo/exit pair

Reported by: nbachiyski Owned by: westi
Milestone: Priority: low
Severity: minor Version: 2.3
Component: General Keywords: has-patch
Focuses: Cc:


In tow places in wp-admin errors are taken from WP_Error object and are just printed and the script ends.

Thus it is both not very beautoful and doesn't issue the correct encoding headers. Using wp_die solves both problems.

Attachments (1)

wp_die-insteadof-echo-exit.diff (1.1 KB) - added by nbachiyski 7 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 @westi7 years ago

  • Owner changed from anonymous to westi
  • Status changed from new to assigned

+1 to the first change

Can we change admin-ajax.php like that as we a returning the error to js not the browser?

comment:2 follow-up: @ryan7 years ago

Maybe add a WP_Error::die_with_message() method?

comment:3 in reply to: ↑ 2 @westi7 years ago

Replying to ryan:

Maybe add a WP_Error::die_with_message() method?


It might be nice if we can come up with something nice to replace the following:

if ( is_wp_error($result) )
    wp_die( $result->get_error_message() );

It would nice if all occurrances of the above could become oneliners like:


comment:4 @santosj7 years ago

if( is_wp_error( $result ) )

Pretty, short, and sweet

comment:5 @Denis-de-Bernardy6 years ago

maybe even change is_wp_error() to die automatically?

comment:6 @Denis-de-Bernardy6 years ago

  • Milestone 2.9 deleted
  • Resolution set to invalid
  • Status changed from accepted to closed

can't find any trace of die statements in there.

Note: See TracTickets for help on using tickets.