Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Disable site visiting and user logins excepting for a specific user

Your if case matches any user who is not both a super admin and test_user.

For example, given a user test_user who is not superadmin, the result would be

if (true || false) redirect

Since one condition is true, the redirect would be triggered. Using the && operator, you’d get

if (true && false) redirect.

Since both are not true, it doesn’t trigger the redirect.

Related Posts:

  1. Good way to block users within a multisite setup without deleting them?
  2. Some Subdomains on a Multisite Install Not Found
  3. Is there a is_user_logged_in() for multisite?
  4. Troubleshooting a “You do not have sufficient permissions to access this page” error
  5. Restrict users on multisite WordPress install
  6. Unable to login to new custom domain on multisite?
  7. share login/logout sessions across two installs?
  8. How to Login Once to an Entire WP Multisite Network
  9. Can you have multi-site WP and keep users separate?
  10. Multisite – Redirect All Users to Subsite Home Page on Subsite Login
  11. Restrict the user access in multi site for non-assigned blogs
  12. WordPress Multisite Login Access
  13. Multisite Independent User Base
  14. How can I get multisite primary blog (url or path) for current user?
  15. Subdomain login problems
  16. WordPress Multisite local: wp-login.php refreshes on login Chrome Browser
  17. ‘Remote Login’ with MultiSite Domain Mapping still forcing users to login to all blogs individually?
  18. How to stay logged in on a multisite with different domains?
  19. WordPress Multisite prevent direct access to subdomain
  20. Login on Multiple Sub-Domains without Multisite
  21. Fresh Multisite Install – Can’t Log In
  22. Auto Redirect after login
  23. access the plugins for each role in WordPress multisite
  24. WordPress MultiSite login to the respective site
  25. How to protect post attachments related to a custom post type, from non-logged in users, on 1 subsite of a multisite installation?
  26. Multisite registration problem [closed]
  27. How to fix blocked cookies error that doesn’t let me log into wp-admin?
  28. Subsite access without being a member of the subsite in wp multisite network
  29. Automatically login user across multisite
  30. How can you override the is_multisite check in wp-login.php for individual login/registration?
  31. How to write RewriteRule for login in multisite
  32. Multi-Site Subfolder User Permission Issue
  33. Add access control origin header information across multisite
  34. One Site as a part of Multisite to be hidden (Un-published) from Public?
  35. Multisite Login problem
  36. Https and Http Login Issue on WordPress Multisite
  37. Different Domains in Multisite Setup
  38. Multisite infinite redirect loop
  39. Hiding media uploaded by other users in wordpress multisite?
  40. Infamous admin login redirect
  41. Common user login for two different wordpress installation and bbpress
  42. How to check main site user level from subsite in a multisite network
  43. Give users acces to admin a single post or set up WP network?
  44. Is there something I need to know in order to use WordPress on foreign (Swedish) TLDs?
  45. Restrict users of site 1 to login in site 2 in wordpress multisite
  46. Unable to execute Ajax request, status code 400
  47. How to display custom logo on WordPress login page
  48. Moving from a non WordPress site to a WordPress Site – Login between both sites
  49. WordPress Multisite: Login to all subsites at once
  50. Users getting linked unwanted to main mu in WordPress multisite (WPMU)
  51. Multisite – site user limited only for this site
  52. Unable to sign in to network after moveing address but able to login into child sites
  53. User not staying logged into one of sub sites in multisite after SSL
  54. Single sign on to sub-sites in Multisite Network
  55. WordPress automatic Login on other page?
  56. how to make a cronjob run, when user needs to be logged in
  57. WordPress Network with SSL for multiple domains
  58. Why does this multisite redirection loop vanish when I add “www.”?
  59. WordPress Multisite FQDN Admin Access
  60. One login for 3 WordPress installations with combined user table doesn’t work
  61. Multisite: Redirect Subsite Administrator to Subsite Home Page, Bypassing Dashboard
  62. Admin user getting redirected to /wp-admin/user
  63. How to login a user with wp_set_auth_cookie on a specific blog within a multisite environment
  64. Is it possible to create a login for restricted visibility?
  65. How do I combine wp_redirect and add_filter?
  66. Common login for websites belonging in different networks
  67. Best Way to Setup a Network of WP Sites?
  68. WordPress Multisite restict user access
  69. Error Message when logging into WordPress on Xampp
  70. Multisite Login Access Restrictions
  71. WordPress MU: Cookie error when trying to login on network WP instance
  72. something in database is causing me to not be able to log into network admin of multisite
  73. Weird Issue – WordPress Multisite – Cannot Access subdomain’s pages
  74. Convert existing site to network
  75. How do I transition multiple installations to a single Multisite installation?
  76. New Multisite Network: redirected you too many times
  77. Protect Uploads in Multisite
  78. Global Parent theme for all sites
  79. the blog owner multisite
  80. How to properly force https and www on multisite with Apache HTAccess
  81. Display site administrator’s id by current blog id inside link
  82. SELinux security vs WordPress updates
  83. Switch MultiSite main site with another (multilingual sites) – with subfolder – no subdomain
  84. Updated to version 3.8 and Admin pages are very slow. How to diagnose problem? [closed]
  85. Multisite install on subdomain w/ subdomains change siteURL
  86. How to check main blog in a multisite using if statement?
  87. How can I map the primary domain for subsite as subdirectory for another domain?
  88. Website not listed under Sites (in a Network environment)
  89. get_site_option / update_site_option – the main site and sub sites do not share the same storage
  90. Number of total comment does not tally with the number of comment?
  91. Subsites in Multisite throw 404 in wp-admin
  92. WordPress theme to support single website but with 3 sections for 3 languages
  93. Update siteurl and home in multisite subsites to https
  94. WordPress multi-domain with multiple sites with multiple languages
  95. Domain level problem for multisite?
  96. Redirect www.mainsite.com/subsite/wp-login to www.mainsite.com/wp-login
  97. Activation of new Registered site fails on multisite
  98. How does adding custom meta to signup form work?
  99. Can’t un-archive site after upgrading to WordPress 3.8
  100. How to handle responsive and non responsive websites in one WordPress Theme?
Categories multisite Tags login, multisite, user-access
Outputting HTML elements through WP-API
Get posts with no tags?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress