For anyone who this might help, I found a working solution. Redirecting is working and users can see their images at the front-end WP Media Uploader.
function my_noAdminAccess(){
if ( is_admin() && ! current_user_can( 'delete_others_posts' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ){
if( wp_get_referer() ){
wp_safe_redirect( wp_get_referer() );
}
else{
wp_safe_redirect( site_url("https://wordpress.stackexchange.com/") );
}
exit;
}
}
add_action( 'admin_init', 'my_noAdminAccess', 100 );
Related Posts:
- Redirect subdomain homepage to domain specific page in wordpress multisite
- Multisite Redirect issue
- Why my deleted url is redirecting to random post?
- Multisite setup help – plain domain/subsite always redirects to domain with subdir multisite
- 301 Redirection After Comment
- External rewrite rules missing in htaccess – Multisite
- Redirect Main Site to Subsite in Multisite WordPress
- Why is WordPress Multisite redirecting to wp-signup.php and how to fix it?
- How to disable Multisite sign-up page?
- WordPress multisite,several different languages,page redirect?
- WordPress Multisite – Multiple subfolders for blogs
- WordPress multisite subdirectory redirect infinite loop issue
- multisite htaccess 301 redirects
- W3 Total Cache Plugin with WP 3 MultiUser [closed]
- Multisite wp-admin redirect loop
- WordPress network (multisite) /wp-admin/ redirect loop (ERR_TOO_MANY_REDIRECTS)
- Multisite – Redirect All Users to Subsite Home Page on Subsite Login
- 301 Redirects for posts, category, pages from original domain to sub-domain of multisite
- Trying to access second site dashboard on a multisite configuration proceeds to an error
- Redirect loop (only for multisite network admin)
- Why wordpress multisite redirect to wp-signup if site exists?
- Sub-subdomain getting redirected to main domain
- How to set Active plugins as the default screen?
- Multisite network admin – URL / redirect error
- How to Rename wp-login.php for Multisite?
- How to exclude a directory from WordPress permalinks in a Multisite environment?
- WordPress multisite subdirectory on nginx behind reverse proxy
- How to Redirect login User with Mapped Domiain Primary blog Url to Original Sub-site Url
- Disable domain redirect
- Redirect users on logout
- Multisite, multiple domains per site
- Multisite Network menu links not updating
- https redirect hell (adding www)
- WPMU Development Environment
- Redirect subdomain in Multisite installation?
- Issue with htaccess redirection in WP Multisite
- Redirect only posts to New Domain
- Multsite redirecting to the main site
- Redirect & permalink problems after moving multisite to a new server
- Temp URL Redirect Loop
- Installed domain-based Multisite but can’t access wp-admin (redirect loop)
- Redirect Site Geologically
- How to configure Multisite Network with randomized hostnames?
- WordPress Multisite Strange Redirect on Primary Site
- Wrong Redirect/Rewrite Rules?
- Htaccess file isn’t redirecting http sub-pages to https––they display 404 error instead, tried many solutions and none work
- WordPress Multi-Site on Ubuntu 18.04 LAMP Keeps Re-Directing
- URL without www redirect directly with submission page – Multiwordpress install
- Multisite Redirection to new domains
- Nginx config, how can I redirect primary multisite domain, but not its sub-folders, nor other domains?
- Site redirecting to http://example.com/wp-signup.php?new=example.com
- WordPress Multisite + Erros with URLS and ADMIN
- Redirect old uploads after moving to multisite
- 301’s not working with multisite
- Multisite, Subdomain, shared NFS directory Linux HELP
- WordPress: how to change URL for individual MultiSites?
- How to split existing blog into WordPress Multisites without breaking links?
- How to write RewriteRule for login in multisite
- Multisite Subdomain Redirect Mask
- Network Admin URL is shown to anyone before accessing a blog
- Cannot use Network Admin (Dashboard) on Multi-site after 301 www redirect
- 404 redirecting to home [closed]
- Site’s admin created with wpmu_create_blog accessible only on 2nd attempt
- How to temporarily redirect front page of a network to one of the sites/blogs?
- Multisite Redirect for Home Page Only
- Working with Reverse Proxies and Multisite Installation
- How to redirect user after session timeout
- How to Force WWW. in Domain With WordPress MU Domain Mapping Plugin?
- Two installs conflicting – Pages redirecting
- Redirect a WordPress Multisite url after it has been change to a new one
- Redirecting specific sites to HTTP in WordPress Multisite
- multisite 404 subfolder same name slug as site
- After switch domain, some parts of my site still point to my old domain
- How to make the redirects right? IP to domain name folders
- Multisite network admin login redirect
- Multisite wp-admin redirecting to main wp-admin using NGINX
- WordPress multisite redirect one custom non www domain to www
- Multisite (with nested paths) wp-admin redirect loop
- How do I point two urls to the same child site in a multisite config
- Redirecting two Multisite domains to Single site on different host
- All Subsites of a WordPress Multisite install 302 redirects to the main site
- Multisite install in a subfolder won’t work with www
- Multisite login and redirect to users main blog,
- WordPress Multisite redirect loop
- Redirect all users, except network administrators, from the main site to a subsite
- Multisite: Redirect Subsite Administrator to Subsite Home Page, Bypassing Dashboard
- Admin user getting redirected to /wp-admin/user
- How to redirect author subdomain pages to each author pages on www
- Is there a way to have wordpress 301 versus 302 urls by default?
- Multisite move server giving redirect loop
- Pages redirect me to the homepage
- How do I combine wp_redirect and add_filter?
- Multisite redirect loop for a single www domain
- Redirect authors from upload.php url to Home page in Multisite
- How to redirect root blog to a specific one in multilang WP?
- WordPress 3.0 Multisite – Child sites and backends appearing blank
- Nice font not working when http to https – SSL Issue
- Subdomain add comment redirect to 404 not found page iis server
- Multisite Primary Domain Broken All Subsites Work
- Make multisite non-existing subdomains go to homepage instead of Index of/ page