Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted
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'] 

For future reference.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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