我正在尝试删除"垃圾"在wp-admin中链接来自wordpress 页面。我已经设法创建了一个从帖子中删除它的功能,但似乎无法找到关于为页面执行相同操作的任何信息。
从帖子中删除垃圾链接的功能:
<?php
add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );
function remove_row_actions( $actions )
{
if( get_post_type() === 'post' )
unset( $actions['clone'] );
unset( $actions['trash'] );
return $actions;
}
?>
答案 0 :(得分:3)
将下面的代码粘贴到function.php中,并在admin
中查看post / page部分add_filter( 'post_row_actions', 'remove_row_actions_post', 10, 1 );
function remove_row_actions_post( $actions )
{
if( get_post_type() === 'post' )
{
unset( $actions['clone'] );
unset( $actions['trash'] );
return $actions;
}
}
add_filter( 'page_row_actions', 'remove_row_actions_page', 10, 1 );
function remove_row_actions_page( $actions )
{
if( get_post_type() === 'page' )
{
unset( $actions['clone'] );
unset( $actions['trash'] );
return $actions;
}
}
答案 1 :(得分:1)
将此片段添加到wordpress主题的functions.php将删除垃圾回收功能
add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );
function remove_row_actions( $actions )
{
if( get_post_type() === 'post' )
unset( $actions['trash'] );
return $actions;
}
答案 2 :(得分:0)
其实你想用
unset($actions['delete']);