Remove Dashboard Access WordPress 插件
描述
- Limit Dashboard access to admins only, admins + editors, admins + editors + authors, or limit by specific capability.
- Choose your own redirect URL
- Optionally allow user profile access
- Optionally display a message on the login screen
- (more info)
Contribute to RDA
This plugin is in active development on GitHub. Pull requests are welcome!
Capabilities:
- You can limit Dashboard access to Admins only, Editors or above, Authors or above, or by selecting a capability. More information on WordPress’ default roles and capabilities can be found here: https://codex.wordpress.org/Roles_and_Capabilities
User Profile Access:
- You can optionally allow all users the ability to edit their profiles in the Dashboard. Users lacking the chosen capability won’t be able to access any other sections of the Dashboard.
Login Message:
- Supply a message to display on the login screen. Leaving this blank disables the message.
Hiding other plugins/themes’ Toolbar menus:
- Remove Dashboard Access removes some built-in WordPress Toolbar menus by default, but can be extended to hide menus from other plugins or themes via two filters:
rda_toolbar_nodes
(viewing from the admin), andrda_frontend_toolbar_nodes
(viewing from the front-end).
How to find the menu (node) id:
- In the HTML page source, look for the
<li>
container for the menu node you’re targeting. It should take the form of<li id="wp-admin-bar-SOMETHING">
- In
<li id="wp-admin-bar-SOMETHING">
, you want the “SOMETHING” part.
How to filter the disallowed Toolbar nodes on the front-end:
/** * Filter hidden Toolbar menus on the front-end. * * @param array $ids Toolbar menu IDs. * @return array (maybe) filtered front-end Toolbar menu IDs. */function wpdocs_hide_some_toolbar_menu( $ids ) { $ids[] = 'SOMETHING'; return $ids;}add_filter( 'rda_frontend_toolbar_nodes', 'wpdocs_hide_some_toolbar_menu' );
Common plugin Toolbar menus and their ids:
- Jetpack by WordPress.com (notifications) – ‘notes’
- WordPress SEO by Yoast – ‘wpseo-menu’
- W3 Total Cache – ‘w3tc’
Debug Mode
To view debugging information on the Settings > Reading screen, visit:
example.com/options-general.php?page=dashboard-access&rda_debug=1