I have found this thread about the same thing: Remove quick edit for custom post type But I only managed to remove the Bulk edit option with this.
What I want to do is to hide/remove Quick edit from a custom post type?
How do I manage this?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI have found this thread about the same thing: Remove quick edit for custom post type But I only managed to remove the Bulk edit option with this.
What I want to do is to hide/remove Quick edit from a custom post type?
How do I manage this?
You can add a filter to the hook named post_row_actions
.
Here's a sample code: (make sure to replace my-cpt
with the actual post type name)
add_filter( 'post_row_actions', 'my_cpt_row_actions', 10, 2 );
function my_cpt_row_actions( $actions, $post ) {
if ( 'my-cpt' === $post->post_type ) {
// Removes the "Quick Edit" action.
unset( $actions['inline hide-if-no-js'] );
}
return $actions;
}