Add Slug Metabox to posts for contributors
I approached by doing the opposite with using remove_meta_box() for the Slug metabox if the user is not an administrator or contributor: add_action( ‘admin_menu’, ‘wpse_237291_remove_slug_metabox’ ); function wpse_237291_remove_slug_metabox() { $user = wp_get_current_user(); $allowed_roles = array( ‘administrator’, ‘contributor’ ); if ( !array_intersect( $allowed_roles, $user -> roles ) ) { remove_meta_box( ‘slugdiv’, ‘post’, ‘normal’ ); } }