Make WordPress Core

Opened 11 years ago

Last modified 5 years ago

#26268 reviewing enhancement

Add UI to Category page to indicate default category

Reported by: kraftbj's profile kraftbj Owned by: helen's profile helen
Milestone: Future Release Priority: normal
Severity: normal Version: 4.8
Component: Taxonomy Keywords: has-patch ux-feedback needs-testing needs-refresh
Focuses: ui, administration Cc:


Currently, the default category is set in Settings->Writing and it only indicated on the Category page (Posts->Categories) via the lack of a checkbox to delete.

  1. Add a visual indicator on the Categories page to indicate the default category.
  2. Add an option to change the default on the Categories page.

Attachments (19)

default-taxonomy.diff (3.9 KB) - added by paulwilde 10 years ago.
26268.diff (3.9 KB) - added by kraftbj 10 years ago.
Refreshed version of paulwilde's patch
26268.2.diff (6.0 KB) - added by kraftbj 10 years ago.
Updated per
26268.3.diff (6.1 KB) - added by seanchayes 10 years ago. (7.0 KB) - added by keita_kobayashi 10 years ago. (7.0 KB) - added by keita_kobayashi 10 years ago.
Wraps the (default) in for i18n
26268.4.diff (6.6 KB) - added by seanchayes 10 years ago.
26268.4.jpg (76.5 KB) - added by seanchayes 10 years ago.
26268.5.diff (5.9 KB) - added by wonderboymusic 10 years ago.
26268.6.diff (8.3 KB) - added by seanchayes 10 years ago.
26268-default-category-in-list-at-top-01.jpg (108.2 KB) - added by seanchayes 10 years ago.
26268-default-category-in-list-at-top-02.jpg (107.9 KB) - added by seanchayes 10 years ago.
26268-default-category-in-list-at-top-03.jpg (99.5 KB) - added by seanchayes 10 years ago.
row_actions_hover.png (42.1 KB) - added by DrewAPicture 10 years ago.
26268.7.diff (7.8 KB) - added by kraftbj 10 years ago.
Same as .6, minus the user-edit.php revision.
26268.8.diff (3.4 KB) - added by kraftbj 9 years ago.
26268.7 with the CSS and UI to change default removed.
26268.9.diff (3.3 KB) - added by kraftbj 9 years ago.
26268.8 without the bad intent on one line :)
26268.10.diff (3.2 KB) - added by seanchayes 9 years ago.
26268.11.diff (3.2 KB) - added by wonderboymusic 9 years ago.

Download all attachments as: .zip

Change History (62)

#1 @SergeyBiryukov
11 years ago

  • Keywords needs-ui added

#2 @helen
10 years ago

  • Focuses ui added
  • Keywords good-first-bug added; needs-ui removed
  • Milestone changed from Awaiting Review to Future Release

I like this. Possibly with the word "Default" next to the term name in the list table (the way Sticky shows in the posts list table) and another row action to "Set as Default". Probably needs some thought about the individual edit term screen.

I would then add 3. Remove from Settings -> Writing.

#3 @paulwilde
10 years ago

  • Keywords has-patch added

Created a patch which will do the following:

  • Adds a "Default" label in the same style as Sticky/Draft shows in the post rows.
  • Adds an action titled "Set as Default" if the user has permission to manage options which sets the default taxonomy. This is limited to only show for the category taxonomy, but could be abstracted in future should other taxonomies need the ability to have a default.
  • Removes the Default Category setting from Settings -> Writing.
Last edited 10 years ago by paulwilde (previous) (diff)

#4 @nacin
10 years ago

  • Owner set to paulwilde
  • Status changed from new to assigned

Nice, paulwilde! We'll get someone to review this.

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.

10 years ago

#6 @kraftbj
10 years ago

This works for me. Patch is stale for /wp-admin/includes/class-wp-terms-list-table.php, so attaching an updated one. No changes to the patch itself.

10 years ago

Refreshed version of paulwilde's patch

#7 @helen
10 years ago

  • Keywords ux-feedback added

Thanks for the patch, paulwilde, and thanks for refreshing, kraftbj. It's working great, and I like how it feels. There are a few things it's exposing to me at the moment:

  • After you set the default, you get redirected back to the first page of the list table, rather than the one you were on. Editing a term does return you to the appropriate page.
  • We need an updated message at the top letting the user know the action was successful.
  • We should probably do the same thing for link categories - the UI for links is hidden in new installs, but when it is shown, it would be nice to use the same paradigm.
  • We should probably set the "Set as Default" string to not wrap (CSS).

Going to try running this shift by jenmylo for a UX check as well.

#8 @kraftbj
10 years ago

Taking @paulwilde's initial patch and adding in the suggestions by Helen, particularly:

  • Updated the redirect URL to included a paged query arg to redirect back to initial page.
  • Added a message indicating Category default was set. Though unused, added similar messages to the other cases to keep the arrays consistent.
  • Duplicated the work for Links (including it in the conditional for displaying the Set as Default and removing the default from Settings->Writing)
  • Set CSS to nowrap the line, and removed the nbsp from Quick Edit in the same set of action items for consistency.

Additionally, I added a nonce check for it, just to be safe.

Last edited 10 years ago by kraftbj (previous) (diff)

#9 @seanchayes
10 years ago

I found this patch worked really well. I also found that it was being applied to Tags or non-hierarchical taxonomies. For example, with the 26268.2 patch I found I could set a tag as default and then I couldn't remove it.

So I have the following modified patch:

26268.3 - this modifies the "Is this the Category or Link Category" check so that the "Set as Default" option is only active on the Category admin page.

10 years ago

#10 @kraftbj
10 years ago

Thanks for catching that. I had it working right, but must have changed it up and not properly tested it.

Confirmed that .2 is deficient as stated and .3 resolves it.

#11 @keita_kobayashi
10 years ago

I really like this new UI, but realized that the user may not remember which category was set as default when authoring a new post. I'm not sure this is in the scope of this patch, but maybe having a "(default)" will remind the user that that category will be automatically applied if no other category is manually selected? I've attached a simple implementation of this in .

10 years ago

Wraps the (default) in for i18n

#12 @kraftbj
10 years ago

@keita_kobayashi: I don't know if it is within the scope of the ticket or not, but it's a nice touch :-)

My thoughts on that piece:

  1. What about, in addition to the label, on a new post it is outputted first? e.g.

Category 1 (default)

  1. When editing an existing post, does the user care what the default category is? Does the label still need to be there?

I defer to the core developers on if this should be part of this ticket or figured out before deciding on the rest of the patch.

This ticket was mentioned in IRC in #wordpress-dev by kraftbj. View the logs.

10 years ago

#14 @helen
10 years ago

26268.3.diff works well, looks good at a glance. It exposes something to me though - you can't quickly get an idea which category is your default if you have lots of them. What could be done there? Possibly show the default at the top of the list?

#15 @seanchayes
10 years ago

I've updated the patch - now 26268.4.diff - so it displays the default category above the table list of categories. This allows the default category to persist in display when navigating through the category list.

I have also added a screenshot of how it looks.

10 years ago

10 years ago

This ticket was mentioned in IRC in #wordpress-dev by kraftbj. View the logs.

10 years ago

#17 @wonderboymusic
10 years ago

  • Milestone changed from Future Release to 4.1

26268.5.diff accounts for [29782] - this seems like a good enhancement for 4.1

#18 @DrewAPicture
10 years ago

  • Owner changed from paulwilde to seanchayes

#19 @helen
10 years ago

What are the chances we can float the default term to the top of the list? I have a feeling it might not be pretty, given paging.

#20 @kraftbj
10 years ago

@helen: First glance, not pretty.

What is your thinking behind floating it to the top? Add visibility? Quicker to find to edit? Would linking the "Default Category: X" text added in 26268.4.diff to the edit terms page meet the objective?

#21 @seanchayes
10 years ago

I took 26268.5.diff and added the idea from comment:19.

I've applied the code changes into 26268.6.diff and uploaded three images showing how I interpreted that comment.

The default category shows at the top of the list :

  • The first time the list is displayed. (image 1)
  • For times when the category list is processed for paging. (image 2)
  • When a column is chosen as the column to sort on including when paged. (image 2)
  • When a search is performed using "Search Categories" (image 3)

10 years ago

#22 @DrewAPicture
10 years ago

Just a couple of things that jumped out at me about 26268.6.diff:

  • We probably need a more specific selector on nowrap-ing the 'Set to Default' string, .row-actions a is pretty global and could have more far-reaching effects elsewhere in the admin
  • Something else wasn't really well-illustrated in the screenshots is that row actions are now forced to two lines because of the width of the column (see row_actions_hover.png). At first I figured the row actions count was off because the separator was on the end of the line but then I realized it was wrapping

I kind of wonder if maybe instead of trying to add a seldom-used action link to the row actions, perhaps that might be a better fit in edit-tags and/or quick edit.

#23 @kraftbj
10 years ago

@seanchayes - As confirmation, did the user-edit.php diff slide in my mistake in 26268.6.diff ?


  • We could argue that the .row-actions a is a good idea either way since having a line break within a link in row actions is poor UI. May be better discussed in a separate ticket, though, since it would impact more than this and/or more specific selector.
  • The two-line doesn't concern me, in and of itself. It is already two lines on thinner viewports (~<1300px).

#24 @seanchayes
10 years ago

@kraftbj - did I lose some code that you provided? I'm not sure I recall any changes to user-edit.php? Sorry. I pulled down 26268.5 and then created .6 from that. So I hope I've not messed anything up.

I'm thinking that the ability to set the default category at anytime whilst browsing through the category list is useful. I do also agree it's a seldom used option (comment:22), but it is now in a more logical place and with a visual cue compared to where it was before this patch.

As @kraftbj says, forcing the action text to display on two lines does already occur.

#25 @kraftbj
10 years ago

@seanchayes - On the contrary, looks like extra changes were added in 26268.6.diff (see the end of the patch). Maybe testing out another patch and hadn't svn revert -R .?

In either event, refreshing the patch.

10 years ago

Same as .6, minus the user-edit.php revision.

#26 @seanchayes
10 years ago

Ugh - thanks and apologies.

This ticket was mentioned in Slack in #core by kraft. View the logs.

10 years ago

This ticket was mentioned in Slack in #core by kraft. View the logs.

10 years ago

#29 @johnbillion
10 years ago

  • Milestone changed from 4.1 to Future Release

Adding a "Set as default" link to every row seems like a lot of unnecessary visual noise. How often do you change the default term for a given taxonomy?

#30 @kraftbj
9 years ago

  • Focuses administration added

Chatted with @helen in Slack:

Where we're at now is we're trying to push too much in this one ticket.

This ticket will focus exclusively on the UI for indicating the default category, which should be a quicker win for users.

The CSS change I'm dropping completely. Checking /wp-admin/ more, using a &nbsp; is what is used elsewhere (with the exception of #31482) and provides the same benefit.

The UI for *changing* default category will be discussed in #31483

9 years ago

26268.7 with the CSS and UI to change default removed.

9 years ago

26268.8 without the bad intent on one line :)

This ticket was mentioned in Slack in #core by kraft. View the logs.

9 years ago

#32 @seanchayes
9 years ago

  • Keywords needs-testing added

In the spirit of Trac Gardening I've refreshed this patch. It:

  1. Displays the default category as the 1st item in the list table regardless of the page number / count in the list. It is also annotated "- default"
  2. As @kraftbj said in comment:20 the UI for changing the default category is not included in this patch.
  3. It reflects the screenshots in between comment:21 and comment:22
  4. I changed the default category a couple of times and sure enough the newly changed default showed up at the top of the list table.

Testing welcome / required.

#33 @chriscct7
9 years ago

@seanchayes that's the spirit! Unfortunately, it looks like your patch didn't upload. Can you try uploading it again please? Thanks!

9 years ago

#34 @kraftbj
9 years ago

.10 works well in testing. It stuck the default at the top of the list table and remained there as I advanced to addition pages of categories.

One edge case: If the default category is a child category.
Previously: It would be shown as a child category (without the checkbox to delete and without the delete option).
.10: It remains at the top of the list table with no difference in appearance compared to a top-level category.

Do we need to preserve the visual indication of a child category on edit-tags.php?taxonomy=category?

#35 @wonderboymusic
9 years ago

  • Owner changed from seanchayes to helen
  • Status changed from assigned to reviewing

26268.11.diff - would lurve your eyes on this

#36 @tzon
9 years ago

I added the patch 12684 that added an edit btn for bulk actions for categories. I added some categories at 3 levels of parenthood. All looked well. I then added this patch to show default category. It showed the default but then did not list the child categories I added previously. I'm not sure why.

This ticket was mentioned in Slack in #core by kraft. View the logs.

9 years ago

#38 @arvindsinghu
7 years ago

  • Focuses docs template performance added
  • Version set to trunk

yes this can be something new for wordpress , we should work on this :)

#39 @DrewAPicture
7 years ago

  • Focuses docs template performance removed

#40 @flixos90
6 years ago

  • Keywords good-first-bug removed

This ticket was mentioned in Slack in #design by boemedia. View the logs.

5 years ago

#42 @boemedia
5 years ago

  • Keywords needs-refresh added

We triaged this ticket in the design team today and it seems to need a new patch first. The last one tested is 4 years old and didn't seem to work. The design team is happy to circle back to give feedback on a new patch. Would be great if a video or screenshot could be included for less technical contributors!

#43 @joyously
5 years ago

I think the list of categories should only list each category once. Showing the default category in the list at the top of each page is confusing and not helpful (the user doesn't need to edit it, just might want to know), because the list is sortable. If I saw the same one on every page I would wonder why I have so many with the same name.

So if the list really needs to show which one is default, I prefer indicating it outside the list itself. But the consideration is that the default does not have a Delete action, and using a label "-- Default" on the term helps to explain why there is no Delete action.

Note: See TracTickets for help on using tickets.