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…

May 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

I'm a software engineer, an everyday web developer and a maker. I usually build sites with PHP, within or without WordPress. I build Internet of Things with Arduino and ESP8266. I'm the founder of Rockit.it and Dailybest.it and I'm actually the Chief Technical Officer of Better Days web agency.

Recommended

A new avatar generator for WordPress with get_avatar and Flathash

Brand new avatars for WordPress Gravatar service

April 7, 2017

3 ways to add author’s image in WordPress

Add author's image in WordPress without a plugin

April 5, 2017

Stop sending email to new user in WordPress admin registration

Prevent WordPress to send notification emails when you manually create new users

March 9, 2017

Add filter on wp_title not working with Yoast SEO plugin

For SEO purposes, in a specific template that has a list of items with pagination, I need to have different…

February 22, 2017

Generate all old PDF preview images with WordPress 4.7

WordPress 4.7 generates thumbnails for PDF files while uploading them in the media library, this is a really good thing…

December 13, 2016

Modify wp_query for a specific category in category.php

Suppose you have a category called “events“, with a custom field with the date of the event, which is different…

April 8, 2016