WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#3775 closed enhancement (worksforme)

wp_die() does not have any formatting options which can break plugins that use AJAX.

Reported by: ajd777 Owned by:
Milestone: Priority: low
Severity: minor Version: 2.1
Component: General Keywords:
Focuses: Cc:

Description

Wp_die() should have a filter on outputted text because currently it forces plugins to work around it or attempt to hackishly avoid it.

For example, if you try to submit a comment through AJAX using the built in functions, there are many instances where wp_die() can be called, and if wp_die() is called the returned text includes a new style sheet and header which breaks the display of the page. Currently the only way around this is to use Javascript to immediately check the returned data and then parse out any error message.j

I would love to see a way to set a temporary option just before functions are called to make it possible to disable the styled output, but a filter would be just as effective.

As an aside, it would be nice if the formatted error message used the theme's error page for most errors.

Change History (7)

comment:1 ajd7777 years ago

  • Priority changed from normal to low
  • Severity changed from normal to minor

comment:2 ryan7 years ago

Ideally, we should be returning WP_Error objects up the stack and allowing the caller to handle the error. Which wp_die()s are you encountering?

comment:3 ajd7777 years ago

While testing my plugin (which among other things submits comments with AJAX), I've hit all of the wp_die()s for comment validation and in wp_allow_comment() at one time or another.

comment:4 Nazgul7 years ago

  • Milestone changed from 2.1.1 to 2.2
  • Type changed from defect to enhancement

comment:5 foolswisdom7 years ago

  • Milestone changed from 2.2 to 2.4

comment:6 lloydbudd6 years ago

  • Milestone changed from 2.5 to 2.7

Please attach a test case.

comment:7 pishmishy6 years ago

  • Milestone 2.7 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Closing as worksforme due to lack of feedback. Please feel free to attach the test case in the future and reopen this ticket.

Note: See TracTickets for help on using tickets.