Make WordPress Core

Opened 4 years ago

Last modified 14 months ago

#57619 new enhancement

register_taxonomy doesn't check for reserved terms

Reported by: milossh Owned by:
Priority: normal Milestone: Awaiting Review
Component: Taxonomy Version:
Severity: normal Keywords: 2nd-opinion
Cc: Focuses: coding-standards

Description

Implement a check in register_taxonomy for reserved terms.

Attachments (1)

2025-07-11_17-02-44.png (42.8 KB ) - added by oglekler 14 months ago.

Download all attachments as: .zip

Change History (2)

#1 @oglekler
14 months ago

  • Keywords 2nd-opinion added

I had a list of 13 taxonomies to register for certain CPT. Of course, I knew about reserved terms, but It didn't occur to me to check and as the result I registered "themes" taxonomy. It worked fine, but I got a side effect that was difficult to discover as editors were using Thumbnail block to add Thumbnail and no one was complaining that "Set featured image" button is gone.

I think _doing_it_wrong() will be very useful to notify that word is reserved and cannot be used as taxonomy.

Note: See TracTickets for help on using tickets.