johnbillion / extended-cpts

A library which provides extended functionality to WordPress custom post types and taxonomies.
GNU General Public License v2.0
979 stars 96 forks source link

Advanced options, initial terms, default term, multiple, editable #71

Closed johnbillion closed 4 years ago

johnbillion commented 7 years ago

From @roborourke on May 31, 2017 14:47

Something I've implemented before would be the ability to define a taxonomy like post formats, I don't think it'd be hard to port over so I'll give it a go at some point but let's see what you think of the potential implementation, using regular taxonomy args:

register_taxonomy( 'name', 'post', [
   'terms' => [ 'slug' => 'Name', 'slug2' => 'Name 2' ], // Default terms
   'default' => 'slug', // mimics behaviour of 'Uncategorized'
   'multiple' => false, // Prevents selection of more than one term, sets walker to radio
   'editable' => false, // makes the terms uneditable via the admin, code only - if true forces 'terms' to exist & prevents their removal
] );

Copied from original issue: johnbillion/extended-taxos#30

johnbillion commented 7 years ago

Yeah I'd be happy to implement this if it worked well.

The existing exclusive argument was designed to work like your multiple argument but it doesn't enforce anything when the terms are assigned.

The editable argument could prevent editing/deleting terms via the newly granular terms capabilities in 4.7+.

johnbillion commented 4 years ago

Doing some housekeeping. While this sounds like a useful feature it's not something I've found a need for myself, so I'm closing this off.