Just like i commented , this will create the dropdown if it doesn’t exists and will save it in the database
remove_meta_box('tagsdiv-book_author', 'book', 'normal');
add_meta_box('custom-taxonomy-author-dropdown','Author','author_dropdowns_box','book','side','high');
function author_dropdowns_box( $post ) {
wp_nonce_field('custom-author-dropdown', 'author-dropdown-nonce');
echo "Author:";
echo "<select id='bauthor' name="bauthor[]">";
echo "<option value="0">None</option>";
$options = get_option('bauthor_dropdown');
if ($option !== false){
echo $options;
}else{
$options="";
$terms = get_terms( 'book_author', 'hide_empty=0');
$object_terms = wp_get_object_terms( $post->ID, 'book_author', array('fields'=>'ids'));
foreach ( $terms as $term ) {
if ( in_array($term->term_id, $object_terms) ) {
$parent_id = $term->term_id;
$options .= "<option value="".$term->term_id."" selected='selected'>".$term->name."</option>";
} else {
$options .= "<option value="".$term->term_id."">".$term->name."</option>";
}
}
update_option('bauthor_dropdown',$options);
echo $options;
}
echo "</select><br />";
}
add_action('save_post','save_my_custom_taxonomy');
and all that is left is to clear the list when you add/edit/delete a term of that taxonomy:
//clear the list when a new term is created: or edited
add_action('edit_book_author','clear_on_add',10,2);
add_action('created_book_author','clear_on_add',10,2);
function clear_on_add($term_id, $tt_id){
delete_option('bauthor_dropdown');
}
//clear the list when a term is deleted:
add_action('delete_term', 'clear_on_delete',10,3);
function clear_on_delete($term, $tt_id, $taxonomy){
if ($taxonomy == "book_author"){
delete_option('bauthor_dropdown');
}
}