Make WordPress Core

Opened 11 years ago

Closed 9 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 11 years ago.

Download all attachments as: .zip

Change History (7)

#1 @westi
11 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?

#2 follow-up: @ryan
11 years ago

Maybe add a WP_Error::die_with_message() method?

#3 in reply to: ↑ 2 @westi
11 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:


#4 @santosj
11 years ago

if( is_wp_error( $result ) )

Pretty, short, and sweet

#5 @Denis-de-Bernardy
9 years ago

maybe even change is_wp_error() to die automatically?

#6 @Denis-de-Bernardy
9 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.