Make sure that the second parameter in the “add_action” function matches the name of your restrict access function. It should look something like this:
add_action('admin_head','my_restrict_access');
function my_restrict_access(){ /* code as before */ }
Glad I could help. 🙂
Related Posts:
- Only allow administrators and editors to access wp-admin
- Only allow administrators and editors to access wp-admin
- Is WordPress secure enough for a multi-user article directory?
- How to check if a user is in a specific role?
- How to prevent access to wp-admin for certain user roles?
- Check if user is admin by user ID
- Restrict admin access to certain pages for certain users
- create users to site with specific language
- Prevent from deleting any user role but subscriber
- What is the capability that permits access to WP-Admin?
- Moving wordpress from localhost to server throws admin panel access error?
- Displaying which Role the current user is assigned to
- How to hide a specific user role option in a user role list?
- Adding HTML/Text to Top of Subscriber’s Profile Backend Page
- Custom role based users are not able to access wp-admin
- How to inhibit dashboard and profile management access to normal users?
- Custom roles showing HTML entities in title form field
- Users Unable to Access Dashboard/Posts/Pages
- Can’t access WordPress as an admin – but I can log in as a user!
- Redirect non-admin users away from wp-admin/index.php (main dashboard page) to wp-admin/profile.php
- Allow administrators to pick post author on custom post type edit screen
- admin_post action not usable if admin access denied to user
- Adding Custom Capabilites
- Why is unfiltered_upload not working despite being enabled?
- Logout USER form backoffice after 30 minutes of inactivity [closed]
- I can´t access my admin panel. I tried all possible solutions
- Lost administrator privileges and can’t find a fix
- Downgrade admin account by mistake
- How to set where user is redirected to after logging in at wp-login?
- How to remove dashboard access (wp-admin) for author but not disable the capabilities?
- Deploying WordPress for clients – what do they have access to?
- How to Find The Email of a WP Admin Account
- User Capabilities are not available in WP REST permission callback?
- Change users.php WP_User_Query
- User Roles: How to hide a plugin from showing in WP-Admin?
- define two login page url
- Newly created user role not displaying on users screen
- Admin Page access
- How to check if a user is in a specific role?
- Not able to access WP Admin, it says “Sorry, you are not allowed to access this page.”
- How to logout the current user without notices and warnings?
- Give wp-admin access for shop managers
- restrict admin panel sections to users
- adding existing menu page on new customer user role
- Localhost install: Administrator lost administrator access; cannot access Dashboard
- WordPress blog fails to open
- Is it possible to tell if a user is logged into WordPress from looking at the cookies which are set?
- Extend user search in the users.php page to allow for searching by role and excluding specified email domains from the “users search” input box
- After Upgrade: $user becomes unknown (id: 0) after successful login?
- how to Hide all products except the General Manager role in the WordPress admin panel?
- Can I rename the wp-admin folder?
- How to restrict dashboard access to Admins only?
- I’m getting a 404 message when I try to access wpadmin
- wordpress wp-admin css not loading
- How to enable a site administrator to edit users in a WordPress network/ multisite setup?
- How to get all capabilities of an existing user role
- wp-admin produces a 302 redirect to itself
- How to set custom editor style when editing the homepage?
- How to disable or hide “collapse menu”
- how to add custom user capabilities using add_user_meta or something else?
- Login to wp-admin “redirect_to” points to wrong URL after migration
- WordPress wp-admin suddenly lost its style
- After changing Site url to https, can’t access login page
- Add custom content in user-edit.php page
- How to use Yoast SEO backend in english even if WPLANG variable is not english?
- How can I add my script to admin using script-loader.php?
- Admin first hook that outputs HTML?
- To remove default dashboard items and add quick draft widget for custom post type
- Why am I unable to login after converting to www?
- why my menu is not appearing on the admin panel
- How to create a WP Admin user in phpMyAdmin for WordPress 4.6
- How do I host WordPress on a hidden domain through a reverse proxy?
- Add javascript confirmation popup on “Move to Trash” link
- List All Enqueued Scripts and Styles
- Can I add my own profile.php?
- Wp-admin is giving me an error “Sorry, you are not allowed to access this page.”. I do have access to the wp-admin besides the dashboard itself
- How can I allow an User to publish only 5 posts per month?
- Custom Admin Pagination links
- Have different site location for wp-admin in IIS
- Why does do_robots() Allow: /wp-admin/admin-ajax.php by default?
- What is the meaning or function of this notice?
- How to create dependent dropdown custom field in wordpress admin post form
- How do I make it so that the all users page is not a white screen?
- Show shipping class on product admin page
- How to make WP page accessile only to specific user roles
- How to load Dashboard default media files via HTTPS even when Browser URL has HTTP
- How to move “Collapse Menu” to top of admin bar?
- Some fields in Settings API form are saving, others are not
- I cannot get the “Read More” button to work!
- Redirect non-admin after login, and in url – /admin
- Child theme loses wp-admin styling
- wp-admin redirects to standard wordpress page
- Options site set empty fields after submitting
- Admin section showing CUSTOM Permalink structure thus resulting in permission error [closed]
- Limit user access to installing/configuring a plugin?
- Admin panel: Javascript not loading properly. Cannot edit pages/posts [closed]
- Non Object Notice Error – How to fix please
- wha does the following function remove from wordpress users admin area? [closed]
- Site admin can login but cannot access wp-admin after domain migration?
- Why when I click on a link into the WP admin panel I am redirected to a link that doesn’t contains wp-admin prefix, so I obtain 404 error