Make WordPress Core

Opened 15 years ago

Closed 14 years ago

#10943 closed enhancement (fixed)

Need way to prohibit creation of new taxonomy terms

Reported by: sirzooro's profile sirzooro Owned by: filosofo's profile filosofo
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.8.4
Component: Taxonomy Keywords: has-patch
Focuses: Cc:


I have site where everyone can submit post. I have created categories, which are usually used by people. Unfortunately from time to time I get post (probably added by some automated software), which is added to newly created category, which name consists of digits only. Therefore I need some way to disable this, e.g. new filter called at beginning of wp_insert_term(), which can be used to deny operation.

Attachments (2)

taxonomy.php.diff (902 bytes) - added by sirzooro 15 years ago.
10943.patch (841 bytes) - added by prettyboymp 15 years ago.

Download all attachments as: .zip

Change History (7)

#1 @sirzooro
15 years ago

  • Keywords has-patch added; needs-patch removed


#2 @prettyboymp
15 years ago

  • Cc mpretty@… added

I have a similar need, but this patch (attachment:taxonomy.php.diff) has some limitations. If wp_insert_term returns a WP_Error than the wp_set_object_terms will return directly after with an error, causing none of the terms to be mapped to the object. I think a better solution would be the ability to filter our the new terms before the loop even begins.

15 years ago

#3 @sirzooro
15 years ago

@prettyboymp: your solution does not address situation when someone adds new tag, etc. using other ways, e.g. page designed to manage tags. I think that your path may be a better solution for #9073.

#4 @ryan
15 years ago

  • Milestone changed from 2.9 to 3.0

#5 @nacin
14 years ago

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

(In [13430]) Add pre_insert_term hook to wp_insert_term(). fixes #10943 props sirzooro

Note: See TracTickets for help on using tickets.