2017-02-13 138 views
-1

我想禁用WooCommerce類別管理面板中的編輯菜單。我的代碼是:禁用WooCommerce類別管理面板中的編輯菜單

add_filter('post_row_actions', 'remove_row_actions', 10, 1); 
function remove_row_actions($actions) 
{ 
    if(has_term('product_cat')) { 
    unset($actions['edit']); 

    unset($actions['inline hide-if-no-js']); 
    return $actions; 
    } 
} 

但它不起作用。我試過谷歌搜索但我找不到我的答案。我該如何解決它?

+0

你可能會在這裏找到一個回答你的問題:http://wordpress.stackexchange.com/questions/110782/remove-categories-tags-from- admin-menu – jmarkmurphy

+0

@jmarkmurphy請注意,wordpress.stackexchange.com **僅僅是**純粹的WordPress問題**,不涉及任何插件或任何第三方主題......它將很高興刪除您的評論......感謝和抱歉。 – LoicTheAztec

回答

1

下面的代碼嘗試function.php文件

add_action('admin_head', 'hide_category_buttons'); 

function hide_category_buttons() { 
    $texonomy = isset($_REQUEST['taxonomy']) ? $_GET['taxonomy'] : ""; 
    if($texonomy =='product_cat'){ 
    echo '<style> 
    .row-actions .edit { 
     visibility: hidden; display:none; 
     } 

    .row-actions .hide-if-no-js { 
    visibility: hidden; display:none; 
    } 
    </style>'; 
} 
} 
+0

謝謝@Ash Patel – zfarzaneh

+0

@zfarzaneh:歡迎... –

相關問題