WordPress.org

Make WordPress Core

Opened 17 months ago

Closed 16 months ago

Last modified 16 months ago

#44872 closed defect (bug) (fixed)

wp_list_categories: term name of 0 not output

Reported by: joyously Owned by: SergeyBiryukov
Milestone: 5.0 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:
PR Number:

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
17 months ago

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

#2 @joyously
17 months ago

  • Focuses accessibility removed

#3 @SergeyBiryukov
17 months ago

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

#4 @SergeyBiryukov
17 months ago

  • Milestone changed from Awaiting Review to 4.9.9

#5 @SergeyBiryukov
17 months 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
17 months 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
17 months 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
16 months 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
16 months 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
16 months 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
16 months ago

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