Change WordPress user roles and capabilities Forums How to or FAQ quick edit and permalink disable for role Reply To: quick edit and permalink disable for role

#3132
digitaliway
Participant

I was able to get this working with the below code. The code you posted does not contain “page_row_actions” and the code on https://www.role-editor.com/block-permalink-edit-button/ does not seem to work so I changed it to the filter “get_sample_permalink_html” below which seems more efficient unless you see a better solution?


//remove quick edit functions for page and post
function remove_quick_edit( $actions ) {
    unset($actions['inline hide-if-no-js']);
    return $actions;
}
if ( current_user_can('page-editor') ) {
    add_filter('page_row_actions','remove_quick_edit',10,1);
    add_filter('post_row_actions','remove_quick_edit',10,1);
}

//hide permalink edit buton on page for role
function hide_permalink() {
    return '';
}

if ( current_user_can('page-editor') ) {
	add_filter( 'get_sample_permalink_html', 'hide_permalink' );
}