Remove the “View” Link in Post Admin

I have a custom post type that I’m just using just to keep data in but I sometimes share it with others, and I don’t want any confusion when the “view” link appears in the admin column.

Is there a way of removing that?

http://img.skitch.com/20110421-des28mtj4br3aeyfxnypnkghsy.jpg http://img.skitch.com/20110421-des28mtj4br3aeyfxnypnkghsy.jpg

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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;
}

Should see you through 🙂

The $actions array consists of the following:

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

To modify users grid view ‘user_row_actions‘ filter can be used.

For future reference.

Method 2

Is there a way to remove the “View” link under the users in the backend User panel? All users are listed with an Edit, Delete, View link. I’m looking to remove that View link. Much appreciated.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x