我正在尝试对后端用户(而不是管理员)隐藏详细信息WordPress仪表板,如Recently Published From our Blog WordPress Events and News Admin Colour Scheme Help Activity Screen Options
我找不到html (php/javascript?)但是找到了一些用于配色方案选取器的html,如下所示:
<h2>Personal Options</h2>
<table class="form-table">
<tr class="user-admin-color-wrap">
<th scope="row">Admin Color Scheme</th>
<td>
<fieldset id="color-picker" class="scheme-list">
<legend class="screen-reader-text"><span>Admin Color Scheme</span>.
</legend>
<input type="hidden" id="color-nonce" name="color-nonce"
value="98ec68455d" /><div class="color-option selected">
<input name="admin_color" id="admin_color_fresh" type="radio"
value="fresh" class="tog" checked='checked' />
<input type="hidden" class="css_url" value="" />
<input type="hidden" class="icon_colors" value="{"icons":
{"base":"#a0a5aa",
"focus":"#00a0d2","
current":"#fff"}}" />
<label for="admin_color_fresh">Default</label>
<table class="color-palette">
<tr>
<td style="background-color: #222"> </td>
<td style="background-color: #333"> </td>
<td style="background-color: #0073aa"> </td>
<td style="background-color: #00a0d2"> </td>
</tr>
</table>
</div>
<div class="color-option ">
<input name="admin_color" id="admin_color_light" type="radio"
value="light" class="tog" />
<input type="hidden" class="css_url" value="https://adsler.co.uk/wp-
admin/css/colors/light/colors.min.css" />
<input type="hidden" class="icon_colors" value="{"icons":
{"base":"#999","focus"
:"#ccc","current":"#ccc"}}" />
<label for="admin_color_light">Light</label>
<table class="color-palette">
<tr>
<td style="background-color: #e5e5e5"> </td>尝试css:
#tab-panel-overview {visibility: hidden;}
.help-tab-content active {visibility: hidden;}
.form-table {visibility:hidden; display:none;}
.user-admin-color-wrap {visibility: hidden; display: none;}还尝试了:
.scheme-list {visibility:hidden;} 没什么。


发布于 2019-06-18 03:40:43
请通过插件或将代码添加到您的functions.php中。这是经过测试的,是否会附加work.See屏幕截图
function stackinnerflow_remove_dashboard_widgets() {
global $wp_meta_boxes;
// Remove At a glance
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
// Remove Activity
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
// Remove News and Events
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
}
add_action('wp_dashboard_setup', 'stackinnerflow_remove_dashboard_widgets' );
// removes the `profile.php` admin color scheme options
remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
// Remove thanks WP
add_action('admin_head', 'stackinnerflow_footer_remove');
function stackinnerflow_footer_remove() {
echo '<style>
#footer-thankyou,
#footer-upgrade {
display:none;
}
</style>';
}
// remove the Help Tab use
add_action('admin_head', 'stackinnerflow_remove_help_tabs');
function stackinnerflow_remove_help_tabs() {
$screen = get_current_screen();
$screen->remove_help_tabs();
}
//remove the Screen Options Tab
add_filter('screen_options_show_screen', '__return_false');如果您为低于管理员权限级别的用户包装了所有代码,则除了管理员之外,任何作为编辑者或更低级别的用户都看不到这一点。
if (current_user_can('editor')) {}
如果您想遍历许多其他功能,请检查这个问题:https://wordpress.stackexchange.com/questions/131814/if-the-current-user-is-an-administrator-or-editor

发布于 2019-06-17 03:34:23
您是指管理仪表板小部件吗?你可以通过下面的wordpress操作来隐藏它们。
function remove_dashboard_widgets() {
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );https://stackoverflow.com/questions/56621631
复制相似问题