在Post Admin中删除“查看”链接


Answers:


22
add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );

function remove_row_actions( $actions )
{
    if( get_post_type() === 'my_cpt' )
        unset( $actions['view'] );
    return $actions;
}

应该会通过:)

$ actions数组包含以下内容:

$actions['edit'] 
$actions['inline hide-if-no-js'] 
$actions['trash'] 
$actions['view'] 

要修改用户,user_row_actions可以使用网格视图' '过滤器。

备查。


感谢Wild Phoenix,尽管它似乎没有用。我添加了cpt,并且查看链接仍然出现。
Marco Marco

抱歉,我错过了get_post_type()方法的花括号,请尝试!
Cristian

做到了!真棒帮助Wild Phoenix。非常感激!
马可(Marco)

我在哪里在上面添加代码?

@Darren您可以简单地将此代码复制粘贴到模板的functions.php文件中。希望有帮助!
2012年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.