9

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

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

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.

  • Thanks Wild Phoenix, though it doesn't seem to be working. I add my cpt and the view link still appears. – Marco Apr 21 '11 at 15:05
  • Sorry I missed the braces on the method get_post_type() try that! – Cristian Apr 21 '11 at 15:25
  • That did the trick! Awesome help Wild Phoenix. Much appreciated! – Marco Apr 21 '11 at 15:42
  • Where do I add the code above? – user11680 Jan 4 '12 at 12:24
  • @Darren You can simply copy paste this code into your functions.php file of your template. Hope that helps! – Cristian Jan 23 '12 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.