2014-07-12 31 views
1

嗨刪除「父」下拉我下載一個插件「簡單工作人員名單」和它做什麼,我需要,但我不想編輯器創建一個子類。我如何刪除/隱藏表單上的「Parent」選擇框? parent selectobox on formWordPress的:從類別形式

+0

Eeeek!必須有一個人的樣子......剛剛發現這個:http://wordpress.stackexchange.com/questions/58799/remove-parent-selection-when-adding-editing-categories – moonunit7

回答

0

您可以使用 register_taxonomy() FUNC

'hierarchical' => false, 
'parent_item' => null, 
'parent_item_colon' => null, 

此設置這些選項會刪除父字段。 Eeeek!

+0

非常好,乾淨 - 歡呼! – moonunit7

+0

謝謝@ moonunit7很高興幫助:) – Adeel

+0

答案可能不完全正確。 '「分層」 => FALSE'並轉換類別框成標籤盒(和標籤自然不能具有父標記),但'「parent_item」 =>空, 「parent_item_colon」 =>空,'屬於'labels'數組並且不能與'hierarchical'參數在同一個數組中。 – certainlyakey

2

在當前主題function.php文件中添加波紋管代碼。

add_action('admin_head-edit-tags.php', 'wpse_58799_remove_parent_category'); 

function wpse_58799_remove_parent_category() 
{ 
    if ('category' != $_GET['taxonomy']) 
     return; 

    $parent = 'parent()'; 

    if (isset($_GET['action'])) 
     $parent = 'parent().parent()'; 

    ?> 
     <script type="text/javascript"> 
      jQuery(document).ready(function($) 
      {  
       $('label[for=parent]').<?php echo $parent; ?>.remove();  
      }); 
     </script> 
    <?php 
} 
+0

回答從http複製:// WordPress的。 stackexchange.com/questions/58799/remove-parent-selection-when-adding-editing-categories – vancoder