All your role checks are relative to the user roles in the sub site in which I assume you are not a user. You should also check for is_super_admin()
if( !is_super_admin() && (is_admin() && !defined('DOING_AJAX') && ( current_user_can('subscriber') || current_user_can('media') ) ) ){
wp_redirect(home_url());
exit;
}
Related Posts:
- Prevent “main” WPMU site_url() being returned in functions
- Implementing DNS Prefetching with WordPress
- Different functions file for each site in multisite installation?
- Delete pages and Create default pages for all new network sites
- Multisite, either change the name of sample-page or create new page
- Loop (iterate) through Multi-Site sub-sites (blogs)?
- Global functions on WPMU
- restore_current_blog required after switch_to_blog, if I use that in a function?
- Run function when WordPress new multisite is created or ACF field is updated
- Conditional Gravity Forms filter in WordPress Multisite
- Multisite Ajax serialize return error [object Object]
- Creating new blog on multisite programatically without hacks?
- How to get correct URLs in network wide menu (Multisite)?
- Multisite 404 on pages – rewrite error breaks database
- Has is_archived() for sites in a multisite changed with WP 4.7?
- Function that outputs second theme url
- dynamic site link for future migration in echo do_shortcode()
- wp_get_attachment_image_src returns image on main domain, false on subdomain
- functions.php return custom text
- Members only function, but allow account activation [solved]
- Competing Login Redirects – Need to be Combined?
- Adding a class to the body of an inactive site using multisite
- Run function from parent on child site
- Ads Only at one website inside multisite network – code error
- Different ads on every website on multisite environment
- Upload Multiple Files With media_handle_upload
- Add custom template page programmatically
- What is the difference between get_page_link and get_permalink functions?
- Woocommerce add to simple product attribute programmatically [closed]
- Breadcrumbs showing Parent and Child Pages
- mysql custom wp query
- TinyMCE custom stylesheets for different post types
- Order get_users() by last login date. Is it possible?
- Display random text from a file with the WP built-in AJAX API
- Function to Download External Images to My Site
- How to call a function on particular page like ‘contact-us’ from function.php of child theme
- Detect Safari desktop browser and include the detection in a shortcode
- Is It wrong to use oop approach on functions.php?
- How to preserve edits to Name or Slug of term when using wp_update_term on save?
- ‘is’ functions and ‘get_query_var’ not working
- How Can I Expand the WordPress Customize window without any Plugin?
- Register and enqueue style.css custom theme
- Where do I add html code to the menu div?
- How do I create page navigation linking to each H2 within the page? [closed]
- Add function to every post?
- Understanding and altering the structure of posted images
- What do the schemes login, login_post, admin, and relative mean?
- Allow Post Author to be 0 on Update
- How do I hide or remove ‘Category’ from wordpress breadcrumbs
- Trouble with adding a wp_enqueue_script on wordpress
- Display images that are not in the content
- Display ‘BuddyPress Follow’ follow button to non-logged in users [closed]
- Pagination in relation to archive.php
- wp-admin won’t load after setting wp-login custom url
- Incorrect redirect after commenting
- Get ID of first image attached to a post
- jQuery does not work
- Function naming convention
- Generate featured images old posts
- debugging errors.. how to remedy?
- Where do i create my own function in wp-admin
- Use /prefix/postname as a slug in post_name?
- Send email to admin user when custom post type is created
- Pass variable from action back to template
- Test if a post exists by category and date
- Question about “wp_deregister_script()”
- Output loop to function return?
- Combine embed_oembed_html and oembed_result
- Load JS file only in specific template
- Why get_user_by() doesn’t work in my code?
- Can’t switch to a child theme using filters template, option_template and option_stylesheet
- How to change value of variable in theme file with functions.php WordPress?
- Using functions.php to include code that’s processed inline
- why can’t i add front.css to my frontpage.php
- “All posts” in the category widget
- video.js not enqueueing?
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Display ACF category image on archive and single template files
- How to get taxonomy tree ids without running expensive loops
- Auto delete content in specific folder inside media library
- Using get_terms for custom taxonomy in functions.php
- How to update an image attachment’s alt text from a custom field when saving a post?
- Allow user only create specific tags
- Child theme remove parent filter in functions
- Set URL Parameter Post Layout As Default
- How to display different blocks for mobile and desktops
- WP Enqueue Script Error
- Enqueue JS + CSS via a child theme functions.php file?
- How to add publish/draft button in Admin Post Lists
- Woocommerce – change order status from on-hold to pending payment
- How to add number to wordpress count function?
- How do I integrate my Child Theme into a Custom Template?
- Sending Messages Back to the Template After Processing?
- Why are some custom javascript files working but some are not
- using enqueue_script in a shortcode isn’t working
- Functions file mods and CPU
- How to display milliseconds instead of seconds using timer_stop function? [closed]
- Filter to strip unnecessary attributes
- function to show youtube videos within excerpt – if condition and apply_filters
- sort by date in users