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

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

Recommended

WP Gutenberg notes

Collection of notes and thoughts on Wordpress Gutenberg blocks development.

January 9, 2023

Test page for Bright Link Preview plugin

To test the plugin hover your mouse to a link, or tap the link on mobile device.

December 4, 2022

Updating a metabox after Gutenberg updates

When press on "Update" refresh a custom metabox under gutenberg editor.

WP doesn’t send email? try this

Snippets for sending emails with Wordpress

February 8, 2020

Two post types share the same taxonomy in WordPress

Sharing a WordPress taxonomy between two post types is useful especially if you want to create a relation between different…

November 14, 2019

Modify the language attribute based on category in WordPress

How to modify the language attribute in your Wordpress theme using a specific value

November 7, 2019