Remove or change the view link in WordPress posts list admin

If you want to remove the row action ‘view’ from the admin posts list within a specific custom post type (‘myposttype’):

function remove_row_actions( $actions ) {
    if( get_post_type() === 'myposttype' )
        unset( $actions['view'] );
    return $actions;
}
add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );

If you have a custom plugin or a custom posttype and you want to modify the link that appears near the admin custom posts list:

function modify_the_link($post_url,$post) {
    return '/wp-content/plugins/myplugin/view.php?id='.$post->ID;
}
add_filter('post_type_link',"modify_the_link",10,2);

Anything to say?

Comments with Facebook or below with WordPress



Sorry, WordPress comments are closed on old posts.