Make WordPress Core

Opened 21 months ago

Last modified 6 days ago

#42937 reviewing defect (bug)

Success Message should display on insertion of new category in Taxonomy page

Reported by: manishamakhija Owned by: SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: 4.9.1
Component: Taxonomy Keywords: has-patch has-screenshots has-unit-tests input-validation
Focuses: ui, accessibility, administration Cc:


When we add new category then apart from displaying a new category at the top, there should also display a success message like 'new category added successfully' same as we have in 'Add new post' Page.


Attachments (9)

42937.patch (2.3 KB) - added by manishamakhija 21 months ago.
post-message.png (28.7 KB) - added by birgire 21 months ago.
Post Update Message (current)
category-message.png (44.4 KB) - added by birgire 21 months ago.
Category Update Message (suggested)
42937.1.patch (2.4 KB) - added by manishamakhija 21 months ago.
translatable message and category link added
42937.2.patch (2.2 KB) - added by dilipbheda 21 months ago.
Coding Standard Improvement
error-in-UI-in-add-term.webm (5.7 MB) - added by manishamakhija 18 months ago.
New term not append in term list after successful insertion
42937.3.diff (2.4 KB) - added by birgire 18 months ago.
category-added-ajax-message-with-42937.3.diff.jpg (36.7 KB) - added by birgire 18 months ago.
42937.4.diff (7.7 KB) - added by birgire 18 months ago.

Change History (27)

#1 @manishamakhija
21 months ago

  • Keywords has-patch needs-unit-tests added

I have added patch for this ticket

#2 @birgire
21 months ago

Hi @manishamakhija, welcome to WordPress trac.

This looks like a good improvement, I recall adding tags/categories and not being sure if it was added or not.

I noticed that the following string in 42937.patch is not translatable:

$message = 'New '. $tax->labels->singular_name . ' created successfully'; 


$message = sprintf( __( 'New %s created successfully.' ), $tax->labels->singular_name ); 
Last edited 21 months ago by birgire (previous) (diff)

21 months ago

Post Update Message (current)

21 months ago

Category Update Message (suggested)

#3 @birgire
21 months ago

  • Focuses ui added
  • Keywords has-screenshots added

@manishamakhija I uploaded your screenshots here above, to avoid them being lost if the image hosting changes.

21 months ago

translatable message and category link added

#4 @manishamakhija
21 months ago

Thanks @birgire for your suggestions. I've modified the patch.

#5 @chetan200891
21 months ago

  • Focuses administration added

#6 @dilipbheda
21 months ago

I have made changes to existing .patch to improve coding standard.

  1. Whitespace found at end of line
  2. Expected 1 space before/after closing bracket.
  3. if/else/for/while/try blocks should always use braces

21 months ago

Coding Standard Improvement

18 months ago

New term not append in term list after successful insertion

#7 @manishamakhija
18 months ago

Need for this new enhancement:
In one of my project when I was entering new term in category, it doesn't show at the top/first position though it is added in the backend which displays after page refresh. For more clarification see video I've attached in it. So it's better if we can add success message too.

18 months ago

#8 @birgire
18 months ago

I had another look at this and I would suggest we limit the scope of the ticket to the existing "added" messages. We can see the existing messages here:


There are only three variations for "added":

  • Category added.
  • Tag added.
  • Item added.

where the last one is for a taxonomy that's neither a category or a post_tag.

I also think we should have the "added" ajax admin notice dismissable.

Usually that's done via CSS classes like: notice is-dismissible.

But that's not triggered here via ajax. I think a workaround for that is to trigger the 'wp-updates-notice-added' event.

42937.3.diff is a suggested patch that:

  • Adds a message according to the three existing variations, mentioned above.
  • Adds CSS classes to the admin notice.
  • Makes the admin notice dismissable, by triggering the 'wp-updates-notice-added' event.


  • Find a way to use the translated strings from the $messages array and make the ajax "added" message filterable by term_updated_messages.


  • If we want to modify the "added" message, then I think a new ticket would serve it better.
  • I wonder if the "deleted" message should be considered too? (If so then in another ticket).
Last edited 18 months ago by birgire (previous) (diff)

#9 @birgire
18 months ago

42937.4.diff is a suggested way to:

  • Reuse the translated strings from the $messages array (i.e. with index 3).
  • Allow the message to be filterable with term_updated_messages.
  • Add tests within the new Tests_Ajax_AddTag class with methods:
    • test_add_category().
    • test_add_post_tag().
    • test_add_category_should_work_with_message_filtering().
    • test_adding_category_without_capability_should_error().
    • test_adding_existing_category_should_error().

Last edited 18 months ago by birgire (previous) (diff)

18 months ago

#10 @birgire
18 months ago

  • Keywords has-unit-tests added; needs-unit-tests removed

#11 @gounder
17 months ago

I find this issue with all taxonomies including tags, product categories in WooCommerce or Custom Taxonomies. This really gets difficult when you already have a lot of taxonomy and you have to search for where your addition was added.

other than the message stating which category was added I would suggest like when a category gets deleted that row is highlighted in red the newly added taxonomy is highlighter in green.


#12 @SergeyBiryukov
5 months ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#13 @afercia
4 months ago

  • Focuses accessibility added
  • Keywords input-validation added

#15 @afercia
3 months ago

Thanks everyone for this ticket, patch, and feedback. I'd like to propose a further improvement: when a new term gets created, there's no feedback at all for screen readers. A simple wp.a11y.speak() message would be great, using the same already existing strings for categories, tags, and custom taxonomies:

'Category added.' / 'Tag added.' / 'Term added.'

It would be great to add a speak() message also when terms are deleted :)

This ticket was mentioned in Slack in #accessibility by audrasjb. View the logs.

13 days ago

This ticket was mentioned in Slack in #accessibility by audrasjb. View the logs.

6 days ago

#18 @afercia
6 days ago

  • Type changed from enhancement to defect (bug)

Discussed during today's accessibility bug scrub. Agreed to change this ticket from "enhancement" to "bug" as the lack of proper feedback is an accessibility bug.

Note: See TracTickets for help on using tickets.