#quick-edit
Provides an instant overview of your shop's current customers and the contents of their carts.
Since it sucks to inject CSS and especially to utilize JS to manipulate the WP admin UI, I dove into the core to find out how to remove the Quick Edit functionality which can be useful in some cases or for certain users of the CMS.
In your functions.php (theme or plugin), hook into the following filter(s) to exclude the quick-edit link from the set of action buttons on post listings. Note that when using both these filters it will apply to both the post (and custom post types) and page listings.
add_filter( 'post_row_actions', 'my_disable_quick_edit', 10, 2 );
add_filter( 'page_row_actions', 'my_disable_quick_edit', 10, 2 );
function my_disable_quick_edit( $actions = array(), $post = null ) {
if ( isset( $actions['inline hide-if-no-js'] ) ) {
unset( $actions['inline hide-if-no-js'] );
}
return $actions;
}
In some cases you’d want to perform this change conditionally, like only for certain post types or certain user roles. Add some statements to the mix like so:
add_filter( 'post_row_actions', 'my_disable_quick_edit', 10, 2 );
add_filter( 'page_row_actions', 'my_disable_quick_edit', 10, 2 );
function my_disable_quick_edit( $actions = array(), $post = null ) {
if ( ! is_post_type_archive( 'books' ) ) {
return $actions;
}
if ( isset( $actions['inline hide-if-no-js'] ) ) {
unset( $actions['inline hide-if-no-js'] );
}
return $actions;
}
Posted by Berend on
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Excellent, I have tried other ways but this was the only one that worked for removing it on custom post types made by the plugins I’m using. Thank you and keep up the good work. Your explanation was short and precise. Perfect!
how to remove taxonomy view link
@Anonymous To also remove quick-edit from all taxonomies, add the filter hook “tag_row_actions”:
add_filter( 'tag_row_actions', 'my_disable_quick_edit', 10, 2 );
Perfect. Thanks you
For me it´s working:
if (get_post_type() != ‘books’) {
return $actions;
}
instead of:
if ( ! is_post_type_archive( ‘books’ ) ) {
return $actions;
}
Can anybody please also give some hint on how to disable clone option.
Hey Berend, is it possible to remove the Clone option that lives next to the Quick Edit option?
Thanks in advance,
Dax.
Hi Dax. If you check what the $actions array contains you can find the key for the “Clone” item and unset that.