Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#44872 closed defect (bug) (fixed)

wp_list_categories: term name of 0 not output

Reported by: joyously's profile joyously Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.0 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:

Description

Using a term name of '0' is probably a bad idea, but when it is legacy data, that's what you do.

I have a taxonomy called Ratings, with term names of 0, 0.5, 1, 1.5, etc. up to 5. The slugs have the word 'star' in them, like '0-star' and '3-star'.

When using wp_list_categories() to show them all, the one with '0' is not output. Other methods of showing them, such as the menu admin page, the taxonomy admin page, and the tag cloud widget all show the '0' term. If I use the Edit term page, and change the '0' to '0-', it is then output with wp_list_categories().

Somewhere in the function, empty() is causing a problem.

Change History (11)

#1 @mukesh27
6 years ago

  • Focuses accessibility added
  • Keywords needs-patch 2nd-opinion added

#2 @joyously
6 years ago

  • Focuses accessibility removed

#3 @SergeyBiryukov
6 years ago

  • Keywords needs-unit-tests added; 2nd-opinion removed

#4 @SergeyBiryukov
6 years ago

  • Milestone changed from Awaiting Review to 4.9.9

#5 @SergeyBiryukov
6 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 43605:

Taxonomy: Make sure wp_list_categories() correctly outputs term name of 0.

Props joyously, SergeyBiryukov.
Fixes #44872.

#6 @SergeyBiryukov
6 years ago

  • Keywords fixed-major added; needs-patch needs-unit-tests removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for 4.9.9 consideration.

#7 @SergeyBiryukov
6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 43620:

Taxonomy: Make sure wp_list_categories() correctly outputs term name of 0.

Props joyously, SergeyBiryukov.
Merges [43605] to the 4.9 branch.
Fixes #44872.

#8 @pento
6 years ago

  • Keywords fixed-major removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

[43605] can be ported to the 5.0 branch.

[43620] needs to be reverted from the 4.9 branch.

#9 @SergeyBiryukov
6 years ago

In 43711:

Taxonomy: Revert [43620] from the 4.9 branch.

This change is out of the 4.9.x scope, and will be reintroduced in 5.0.x.

See #44872.

#10 @SergeyBiryukov
6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 43712:

Taxonomy: Make sure wp_list_categories() correctly outputs term name of 0.

Props joyously, SergeyBiryukov.
Merges [43605] to the 5.0 branch.
Fixes #44872.

#11 @SergeyBiryukov
6 years ago

  • Milestone changed from 4.9.9 to 5.0
Note: See TracTickets for help on using tickets.