Make WordPress Core

Opened 14 years ago

Last modified 6 years ago

#16243 new enhancement

Unhelpful error messages when updating default category

Reported by: iamfriendly's profile iamfriendly Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.4
Component: Taxonomy Keywords: needs-patch
Focuses: administration Cc:

Description

If we try and change the default category slug to one that has already been used we get conflicting error messages between quick edit and full edit.

If you use Full Edit you're simply told Item Not Updated however, if you use quick edit, you are informed that the slug has already been used.

The full edit error message is, I think, on line 223 of wp-admin/edit-tags.php - I'm unable to find where the error message for the quick edit functionality is, however.

Having correct and useful copy in error messages is vital, especially for relative newcomers to WP.

This oversight was found by Relly Annett-Baker (@RellyAB on twitter) - one of the best copy writers and content strategists out there. Perhaps we could look at overhauling the error messages and ask (someone like) Relly to give them a once-over or offer advice on them.

Attachments (3)

edit-tags.php (14.9 KB) - added by iamfriendly 14 years ago.
edit-tags.php with additional error reports
16243.2.diff (621 bytes) - added by solarissmoke 14 years ago.
16243.diff (621 bytes) - added by solarissmoke 14 years ago.

Download all attachments as: .zip

Change History (13)

#1 @scribu
14 years ago

  • Component changed from Warnings/Notices to Administration
  • Keywords ux-feedback added; error category copy warnings notices removed

#2 @iamfriendly
14 years ago

As an addition, the quick edit notice is:

"The slug [slug-here] is already in use by another term"

Which is much more useful.

This appears to be from Line 2285 of wp-includes/taxonomy.php

After looking further through edit-tags.php it appears that if there is absolutely any error at all then it simply punts the same message 'Item not updated'. This can be seen on line 143-146 which basically says if there's no error say 'Item updated' but if there is, say 'Item not updated'

From what I can tell there's no checking what the actual error is.

Last edited 14 years ago by iamfriendly (previous) (diff)

#3 @scribu
14 years ago

  • Keywords needs-patch added; ux-feedback removed

I think it's pretty clear that adding more descriptive error messages is a good idea.

We'll leave ux-feedback for after we have a patch.

@iamfriendly
14 years ago

edit-tags.php with additional error reports

#4 @iamfriendly
14 years ago

I've added a horrible hack which adds some extra error reporting to the output when an error is thrown. This basically checks for the existence of certain items in the $ret object. There must be a better way to handle this, though, as it's basically hardcoded in. Possibly use WP_Error() in the future? That's beyond my abilities at the moment, but at least this way there's the same feedback given from quick edit and full edit.

#5 @solarissmoke
14 years ago

  • Keywords has-patch added; needs-patch removed

Seems better to use the error that wp_update_term issues and wp_die rather than redirect?

@solarissmoke
14 years ago

#6 @solarissmoke
14 years ago

Oops managed to attach patch twice

#7 @johnbillion
13 years ago

  • Cc johnbillion@… added

#8 follow-up: @c3mdigital
11 years ago

  • Keywords ui-feedback added

I like using the same error that wp_update_term issues but not sure about the wp_die(); What about not doing the redirect and reload the page instead with the error message in the admin notice?

#9 @nacin
11 years ago

  • Component changed from Administration to Taxonomy
  • Focuses administration added

#10 in reply to: ↑ 8 @boonebgorges
10 years ago

  • Keywords needs-patch added; has-patch ui-feedback removed
  • Milestone changed from Awaiting Review to Future Release

Replying to c3mdigital:

I like using the same error that wp_update_term issues but not sure about the wp_die(); What about not doing the redirect and reload the page instead with the error message in the admin notice?

Yes, but the trick is that the error message from wp_update_term() will have to be passed along to be displayed on the next page load. With other messages, the 'message=5' query var is used, where 5 (or whatever) matches an item in the $messages array.

Since we're probably going to have to duplicate the text from wp_update_term() messages in the $messages array anyway, we should probably go ahead and make the text a bit friendlier. The error messages returned from wp_update_term() are meant to be shown to a developer, not an end user.

Note: See TracTickets for help on using tickets.