Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#56352 closed defect (bug) (fixed)

Docs: Clarify that `register_taxonomy()` only accepts lowercase values for the `$taxonomy` parameter

Reported by: audrasjb's profile audrasjb Owned by: audrasjb's profile audrasjb
Milestone: 6.1 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: good-first-bug has-patch commit
Focuses: docs Cc:

Description

This issue was pointed out by @bengreeley in a DevHub User Contributed note:

Both register_taxonomy() and register_post_type() have a known bug where the taxonomy or post type name needs to be lowercase to work properly (see #16600).

This page mentions lowercase [JB: `register_taxonomy` devhub page] in 'Additional Parameter Information', which is buried a bit deeper on the page. I'd recommend to update this page to include language such as "may only contain lowercase alphanumeric characters" in the main parameter section for $taxonomy, similar to the way it's added for register_post_type() at https://developer.wordpress.org/reference/functions/register_post_type/

Since using anything but uppercase can lead to serious issues that have yet to be resolved I think making this more obvious would be beneficial to the end user.

Attachments (3)

56352.patch (855 bytes) - added by dipakparmar443 3 years ago.
I have update the inline document in attached patch file
56352.2.patch (861 bytes) - added by dipakparmar443 3 years ago.
Desc: updated patch
56352.3.patch (861 bytes) - added by dipakparmar443 3 years ago.
Please check latest update patch

Download all attachments as: .zip

Change History (9)

This ticket was mentioned in Slack in #docs by benjgrolleau. View the logs.


3 years ago

@dipakparmar443
3 years ago

I have update the inline document in attached patch file

#2 @dipakparmar443
3 years ago

  • Keywords has-patch added

@dipakparmar443
3 years ago

Desc: updated patch

#3 @audrasjb
3 years ago

Thanks for the patch @dipakparmar443! Looks like there is a small typo: "Must" should be lowercase as it follows a comma :)

@dipakparmar443
3 years ago

Please check latest update patch

#4 @dipakparmar443
3 years ago

@audrasjb Please check latest update patch

#5 @audrasjb
3 years ago

  • Keywords commit added
  • Owner set to audrasjb
  • Status changed from new to assigned

Looks good to me, thank you 👍

#6 @audrasjb
3 years ago

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

In 53873:

Docs: Clarify that register_taxonomy() only accepts lowercase values for the $taxonomy parameter.

This brings consistency with docblock used in register_post_type().

Props audrasjb, bengreeley, dipakparmar443.
Fixes #56352
See #55646.

Note: See TracTickets for help on using tickets.