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…

Maggio 23, 2016

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

Author

PHP expert. Wordpress plugin and theme developer. Father, Maker, Arduino and ESP8266 enthusiast.