-
Notifications
You must be signed in to change notification settings - Fork 43
Editing taxonomies
scribu edited this page Aug 8, 2011
·
4 revisions
As long as your theme is using the appropriate template tags, you don't need to do anything.
Default behaviour:
- tag-like taxonomies are edited through a text field with autosuggest - terminput
- category-like taxonomies are edited through a dropdown - termselect
If you would like to use the autosuggest for all taxonomies, paste the following code in your theme's functions.php file:
<?php
function fee_choose_taxonomy_interface( $data ) {
if ( isset( $data['taxonomy'] ) )
$data['type'] = 'terminput';
return $data;
}
add_filter( 'front_end_editor_wrap', 'fee_choose_taxonomy_interface' );
If you would like to choose which taxonomy gets which interface, you can do it like so:
<?php
function fee_choose_taxonomy_interface( $data ) {
if ( isset( $data['taxonomy'] ) ) {
switch ( $data['taxonomy'] ) {
case 'taxonomy_a':
$data['type'] = 'termselect';
break;
case 'taxonomy_b':
$data['type'] = 'terminput';
break;
case 'taxonomy_c':
$data['type'] = 'terminput';
break;
// etc.
}
}
return $data;
}
add_filter( 'front_end_editor_wrap', 'fee_choose_taxonomy_interface' );