2016-10-09 56 views
1

所以我知道如何保存的事情,當一個分類編輯這樣的:如何將自定義元框添加到分類法中?

if(!function_exists('mytaxonomysave')): 
function mytaxonomysave($term_id, $tt_id, $taxonomy) { 
    if($taxonomy == 'series'){ 
     if(isset($_POST['type'])){ 
      update_term_meta($term_id, 'type', $_POST['type']); 
     } 
    } 
} 
endif; 
add_action('edit_term', 'mytaxonomysave', 10, 3); 

但我不知道如何添加的metabox到正確的地方,我該怎麼辦?什麼正確的hook¿

回答

0

你要找的掛鉤是:{}分類你的情況_add_form_fields讓你用:

function series_types() { 
    ?> 
    <div class="form-field term-description-wrap"> 
     <label for="tag-type">Type</label> 
     <input type='text' name='tag-type'></input> 
    </div> 
    <?php 
} 
endif; 
add_action('series_add_form_fields', 'series_types'); 
相關問題