After a little bit of trial and error, I finally got my code to work. This will redirect http://example.com/wp-admin/plugins
to http://example.com/wp-admin/admin.php?page=pretty-plugins.php
if the current user doesn’t have access to update core.
add_action( 'admin_menu', 'block_direct_plugin_page_access' );
function block_direct_plugin_page_access() {
global $pagenow;
if ( ! current_user_can('update_core') && 'plugins.php' === $pagenow ) {
if ( function_exists('admin_url') ) {
wp_redirect( admin_url('admin.php?page=pretty-plugins.php') );
} else {
wp_redirect( get_option('siteurl') . '/wp-admin/' . 'admin.php?page=pretty-plugins.php' );
}
}
}
Related Posts:
- Getting Custom Post Type content from main-site of a Multisite
- Cannot access wp-admin after disabling all plugin
- WordPress on AWS with ELB
- Network activating; if ( !current_user_can( ‘manage_options’ ) ) locks me out…
- How to display terms and conditions in post area?
- How to remove a CPT Menu from the Root Admin only
- Add custom fields in the new and edit the site forms without touching the WP core
- Show function to super admin
- Generate pages from markdown files in github automatically
- There is any way to remove post-format filter? [closed]
- Install (enable) plugins on multisite, on localhost
- WordPress multi domain – redirect
- Facebook Messager Plugin
- How can I copy all users to newly created site on a multisite network in WordPress?
- Polylang : Interverting languages after development [closed]
- WordPress wp-admin/network/plugin-install
- Create a multisite network for an existing installation
- “Micro-Site” Options
- External Domain on WordPress Multisite
- Is it possible make a back-end for WordPress with WordPress?
- Create tabs in admin options page from custom post type loop
- How to create user that has permission to create new sites on WordPress with multisite option enabled?
- Configuring Propel to Work with Multisite
- Setup page on first login on multisite
- Dynamic admin submenu
- Subdomains with almost the same content
- Remove ‘Check Compatibility’ from Plugins menu
- Uninstalling plugins across all sites
- Multiple domains issue
- Custom table naming/access convention for multisite: $table_prefix vs base_prefix or other?
- Users are being redirected to main site when trying to register on subsite of my Multisite network
- “Master” WordPress Multisite – Database Sync
- Will these plugins work with wp multisite?
- User Signup in Multisite – Need Plugin or Advice
- Add menu page issues (permissions & position)
- Add custom text color WordPress 3.9 TinyMCE 4 Visual editor
- Redirect to another page using contact form 7? [closed]
- Cannot access my wp-admin after installing Gzip compression [closed]
- Add sub menu page in your plugin
- Certain functions are undefined when called form mu-plugins
- Multisite for Multisite?
- Is there a way to get plugins and themes not built for multisite to work on a network subsite?
- Plugin settings won’t save changes
- Multisite – maximum number of users with specific role
- Is there any way to make myself an admin?
- Full list of registered scripts or styles, but from an admin options page
- Create a single website with 3 theme options in wordpress
- Why shortcode always displayed after footer not in body
- Understanding State in WordPress Multisites
- WordPress Multisite: Programmatically Activate / Deactivate a Plugin of a Specific Blog
- How to make multiple admin pages for one plugin?
- $wpdb update query in plugin only updating one column
- One sub site is slow while all others load fine, same theme & plugins [closed]
- Locked out of admin panel after installing HC Custom WP-Admin URL [closed]
- How can i force wp-admin to use 2-column dashboard layout? [closed]
- Odd /wp-admin/admin-ajax.php entries showing in Wassup
- How can I modify page content in the admin panel?
- Display Plugin Panels Outside of Admin Areas
- How to see which sites use my installed plugins (wordpress multisite)
- How to check wp_options’s rewrite_rules if current and existing are the same before flush the rules?
- Is there a plugin for WordPress for creating ‘Accounts’ where all users who belong to that Account can only see Account data? [closed]
- How to integrate together a website currently hosted WordPress.com and a custom web application currently hosted on Azure?
- WordPress Site is Broken, Cannot see wp-admin page [closed]
- WordPress super admin login issue. (Automatically logout)
- Change the layout of action links under the plugin names
- How do I get the Payzone WooCommerce payment gateway plugin to show up in the settings? [closed]
- Managing wordpress Themes & plugins for multisite
- getting notifications about updates only in the “core” page
- Remove value from array within post meta ajax admin
- Hosting multiple sites
- Is there a better way of handling AJAX requests in WordPress?
- Mowing site to another domain in simplest way
- Issue removing Media Editor Tabs — Duplicate Items
- Get access to WordPress when logged out
- WordPress’s is_plugin_active_for_network function not working for multisites
- Cannot add edit themes and add plugins after multisite update
- Each User has a Personal Blog
- Why are plugin settings not all nested in one place?
- Cannot access WP admin because plugin returns 204
- Install old version of plugin from admin panel?
- WordPress as heavily personalized content management portal, and somewhat like dropbox [closed]
- Storing Form data in a different database
- Completely remove ability to create users?
- how to make a wplang for network fill automatically
- Creating teams of users in WordPress
- Do WordPress plugins suport multisite site?
- Edit page header on a custom plugin
- Multisite Plugin – Access options (wp_options) on child sites
- looking for a multi-user hello-world plugin
- How to get values from network settings panel?
- Share plugins, themes, and multi post in a multidomain network
- Plugin to create unlimited custom shortcodes?
- I cannot include a file in my plugin settings page
- Constructing a Pay to Download music website with wordpress
- After enable multisite enviroment in wordpress site creation wizard not working
- Bulk User Deletion
- 404 errors when updating options in admin dashboard
- Error activating certain plugins
- Can’t save changes or modify settings in Dashboard but Pages and Posts are fine
- Change Dashboard URL from wp-admin to wp-admin/index.php