Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#15428 closed defect (bug) (invalid)

wp_die() filter broken, doesn't pass args

Reported by: somatic Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: General Keywords: wp_die
Focuses: Cc:


There is a filter to manipulate the output of wp_die(), but it is setup incorrectly. When you hook it, the only arg that is passed is the name of the default handler function, which renders the filter useless, as you can't manipulate the message, title, and other display output.

Here's the fix:

wp-includes/functions.php, line 2661


$function = apply_filters( 'wp_die_handler', '_default_wp_die_handler');


$function = apply_filters( 'wp_die_handler', $message, $title, $args);

Change History (5)

#1 @nacin
10 years ago

That wouldn't allow you to modify the title or args.

The point of the filter is to modify the function callback, which will then allow you to have full pluggable control.

#2 @scribu
10 years ago

It's an odd way to do it.

I think it should be transformed into an action and have '_default_wp_die_handler' hooked to it.

#3 @scribu
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Nevermind. Not worth the back-compat hassle.

#4 @nacin
10 years ago

We can add a pre_wp_die hook. I see some good use cases for that.

#5 @westi
10 years ago

The reason it is a filter and not an action is we only want one thing to be called.

I'm not convinced a filter should be made available to filter the message/title/args of wp_die.

If you want to do that you can just add you own handler.

Your handler can still call the default function.

Note: See TracTickets for help on using tickets.