Opened 12 years ago
Last modified 7 years ago
#30687 new enhancement
Ajax media attachment save has no error handling
| Reported by: | Krielkip | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Media | Version: | 4.0.1 |
| Severity: | normal | Keywords: | needs-patch |
| Cc: | Focuses: | ui |
Description
When using the ajax media system on adding media in posts. It is not possible to show errors to the users.
In the file ajax-actions.php (located wp-admin/includes/) in the function wp_ajax_save_attachment_compat() the feedback of errors is trown away. If this code is further developed with visual feedback, the user understand why data is not saved or imported.
Code: (wp 4.0.1 line 2294)
if ( isset( $post['errors'] ) ) {
$errors = $post['errors']; // @todo return me and display me!
unset( $post['errors'] );
}
Change History (4)
#1
@
12 years ago
- Summary Ajax media attachment save has no error handeling → Ajax media attachment save has no error handling
- Type feature request → enhancement
#4
in reply to: ↑ description
@
10 years ago
Can't we use the following function to give some feedback to the user?
wp_send_json_error( $data );
Then Data has the error information and shown good to the user?
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Not sure if this changes how this ticket would get prioritized, but shouldn't this be marked as a bug (rather than enhancement)? The current code actually silently unsets
$post['errors']passed into it and processes without any notice to the user.This took me forever to track down. I updated documentation for the filter 'attachment_fields_to_save' to warn developers that we can't currently validate custom attachment fields with this filter