forked from vincentorback/clean-wordpress-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
users.php
64 lines (56 loc) · 1.39 KB
/
users.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Remove bulk actions from user list
*/
add_filter(
'bulk_actions-users',
function ( $actions ) {
unset( $actions['delete'] );
return $actions;
}
);
/**
* Hide profile fields
*
* @link https://developer.wordpress.org/reference/hooks/admin_print_scripts-hook_suffix/
*
* Visual Editor - .user-rich-editing-wrap
* Syntax Highlighting - .user-syntax-highlighting-wrap
* Admin Color Scheme - .user-admin-color-wrap
* Keyboard Short - .user-comment-shortcuts-wrap
* Show Toolbar - .show-admin-bar
* Language - .user-language-wrap
* Biographical Info - .user-description-wrap
*/
function hide_profile_fields_with_css() {
?><style>
.user-rich-editing-wrap,
.user-syntax-highlighting-wrap,
.user-comment-shortcuts-wrap,
.user-admin-color-wrap,
.user-url-wrap {
display: none;
}</style>
<?php
}
function hide_profile_fields_with_javascript() {
$fields = array(
'first_name',
'last_name',
'url',
'role',
);
echo '<script>jQuery(document).ready(function(){';
foreach ( $fields as $field ) {
echo "jQuery('#{$field}').parents('tr').remove();";
}
echo '})</script>';
}
add_action(
'admin_init',
function () {
add_action( 'admin_print_scripts-profile.php', 'hide_profile_fields_with_css' );
add_action( 'admin_print_scripts-user-edit.php', 'hide_profile_fields_with_css' );
add_action( 'admin_print_scripts-user-new.php', 'hide_profile_fields_with_javascript' );
}
);