Make WordPress Core

Opened 8 years ago

Last modified 3 years ago

#27671 assigned enhancement

wp_die() handler for admin-post.php

Reported by: danielbachhuber Owned by: whyisjake
Milestone: Priority: normal
Severity: normal Version:
Component: Administration Keywords: good-first-bug has-patch needs-testing
Focuses: Cc:


Similar to how admin-ajax.php has _ajax_wp_die_handler, it would be nice if admin-post.phphad a custom wp_die() handler for errors.

Attachments (1)

admin-post.diff (964 bytes) - added by gorantq 5 years ago.

Download all attachments as: .zip

Change History (8)

#1 @nacin
8 years ago

This was done specifically so our AJAX methods would become testable. What would be the benefit to admin-post.php? Same?

#2 @danielbachhuber
8 years ago

For me, use wp_die() as an error handler with admin-post.

#3 @paulschreiber
7 years ago

I looked in admin-ajax.php but couldn't find any handlers. The only place I found _ajax_wp_die_handler was in class-wp-customize-manager.php.

#4 @johnbillion
7 years ago

  • Owner set to whyisjake
  • Status changed from new to assigned

#5 @prasoon2211
7 years ago

I was taking a look at this ticket and found out that the _ajax_wp_die_handler has moved to wp-includes/functions.php.

5 years ago

#6 @gorantq
5 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

#7 @foack
3 years ago

Following the basic tutorial on https://codex.wordpress.org/Plugin_API/Action_Reference/admin_post_(action) and replacing the die() in the example with wp_die(), the wp_die() function triggers _ajax_wp_die_handler located in wp-includes/functions.php.

I'm new in contributing to WP Core but from my perspective, it would not be necessary to extend admin_post.php. If we were to, we'd at least need to avoid redeclaring _ajax_wp_die_handler().

Note: See TracTickets for help on using tickets.