Ok, I was doing a mistake and glad that I found it! I was using admin_menu hook when it should be admin_init.
So the only change I had to make was:
add_action('admin_init', 'restrict_admin_access_by_role', 999);
Hope this would help somebody like me as well!
Related Posts:
- Create mobile site with same content just different theme
- How to hide or remove unwanted widgets on Multisite installation?
- How can I diagnose a slow WordPress admin?
- How to enable a site administrator to edit users in a WordPress network/ multisite setup?
- WP-Admin not working properly at WordPress multisite with subdirectories
- Security in WordPress plugin development
- Hide a theme on list of themes in wp-admin without editing core files
- Difference Between Admin and Super Admin in Database
- wp-admin slow in multisite
- Don’t allow access to wp-admin but allow admin-ajax requests to be fulfilled on frontend?
- Timeout While Upgrading Network in Multi-site
- Uploading Images to Multi-Site Causes Failure to HTTP Error
- Multisite wp-admin redirect loop
- WordPress network (multisite) /wp-admin/ redirect loop (ERR_TOO_MANY_REDIRECTS)
- Copy posts from one blog to another in multisite environment
- My subsites accidentally went from one multisite network to another. How do I change it back?
- Redirect loop (only for multisite network admin)
- Manipulate list of themes in wp-admin
- Add menu page on multisite
- How to remove the Tools menu item from the WP-Admin menu
- Creating a Post form outside of the Admin
- Subsites in Multisite installation throwing 404 error on wp-admin in IIS 7
- How to remove Broken Link Checker widget from admin menu
- How to set Active plugins as the default screen?
- Why can’t I delete original user in multisite? Options for manual removal
- Multisite network admin – URL / redirect error
- Cookie nonce is invalid – Multisite
- WordPress mutisite migration
- Removing “Sub-menus” from My Sites Drop-down in Admin Bar
- Why does the My Site dropdown show only a single domain?
- wp_redirect not working on admin menu page
- Super admin access to a forgotten WP instance?
- Iframe being removed only for some users when publishing a page
- WP Multisite with Domain Mapping : Preventing User Access to Dashboard
- Show media-frame-menu on custom Media Frame
- 2 website 1 database… Local to online
- Updated to version 3.8 and Admin pages are very slow. How to diagnose problem? [closed]
- Moving wp-admin folder to a different host in a multisite environment
- Site’s admin created with wpmu_create_blog accessible only on 2nd attempt
- How to remove and disable access to General Settings Page including its link
- Is There A Plugin to Create WP Multisite Installs programatically
- Can’t log in to wp-admin after setting up Multisite
- How to remove a CPT Menu from the Root Admin only
- Infamous admin login redirect
- WordPress multisite second site admin resulting in too many redirects error
- My Sites link in multisite is incorrect
- Multisite wp-admin redirecting to main wp-admin using NGINX
- WordPress Multisite: Login to all subsites at once
- the menu of the network does not display my second website
- How to Add Super Admin for WordPress multi-site
- network admin pages not linked to correctly
- How to have same admin login for more than one site?
- WP Admin Panel for Multi-site install not loading JavaScript for one Subdomain
- Backend freezing on certain pages of a subsite
- WordPress Multisite giving users access to specific Admin Pages
- Admin user getting redirected to /wp-admin/user
- load styles and scripts in network admin not working
- Pages redirect me to the homepage
- 4th Network Site Database Errors?
- Many big issues in the website, WP_Debug not showing
- What could be changing my WP password and blocking plugins from installing?
- Wp-admin wrongly redirecting on multisite
- Unable to change blog language in multisite
- Multisite logged into one wp-admin, move to another sites wp-admin asked to login again
- Memory growth with new additions to WordPress Multisite
- Create multiple subdomains for multi-site from a database
- multisite htaccess 301 redirects
- using 1 form shortcode (si or cf7) for all multisite sites [closed]
- How to manage multiple domain with different languages on each domain with single wordpress installation?
- Is there any fundamental difference in developing a wordpress multi-network site?
- merging two multisites
- Deleting a user in multisite
- Recover from failed multisite conversion
- Multisite setup on VVV with bedrock
- Multisite Network Localisation
- Can set_transient() be used in multi-site?
- What would you recommend for hosting 10+ individual wordpress websites?
- Redirect only posts to New Domain
- Image problem – Multisite image upload broken
- web.config breaks the themes for sub-directory multisite
- Different use for WordPress Multisite
- Multisite User Sync Question about blog authorship
- WordPress multisite suddenly malfunctioning
- Cannot use pre_set_site_transient_update_themes from within a theme in multisite
- Multisite wordpress config on multidomain
- How to show only blog-domain instead of the whole permalink in the loop
- Multiple subsites in a single wordpress installation
- How to sync roles across Multisite?
- WordPress Multisites or Multiple WP Single sites?
- $_SERVER[‘SERVER_NAME’] in WP_SITEURL
- Two installs conflicting – Pages redirecting
- WP-Cli Error When Mapping Multisite Subdomain
- WP Multisite Sub-Domain Error
- Styles not being applied to multisite setup
- Right approach in doing this signup process
- Editing links to new Site url when user Creates a New Site
- How to disable admin access on new site registration for user in Multisite?
- Maximum Execution Time Exceeded Error while creating New Site in Multisite, Increasing Time Not working
- Moved WP Multisite, cannot access sites
- Using WordPress multisite is there a way to force HTTPS on specific subsites and not others?