Opened 18 years ago
Closed 16 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.
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?