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
- Why use if function_exists?
- Include files in child theme functions file
- Check if post is being published for the first time, or is an already published post being updated
- How to get woocommerce inventory status [closed]
- Why do I get Fatal error: Call to undefined function get_most_recent_post_of_user()?
- Enqueuing External Javascript functions.php
- Function to wrap the_content in a div
- How to run a function once on every post in database?
- Checked() showing up twice in custom fields
- Date/time limitation of posts where function must be executed
- Gravity Forms field entries into wp_query loop [closed]
- Remove the deleted users avatar from list
- Update Content based on expiration time or queued processing
- Adding to fontawesome-webfont.woff2 to boost website speed
- How to enable template page only for a post id page
- Having issues with a foreach inside of a shortcode with ACF gallery
- Remove after images
- Is there an alternative to get_template_directory_uri()?
- Word Press – Dynamic Content [closed]
- Get First Child Page ID or Permalink in WordPress Admin
- Footer disappears when using the_content ( )
- Get page id or status by private pages?
- Categories as main menu items and subcategories as nested lists
- woocommerce change currency per category [closed]
- shortcode help require
- AMP – Change rel=”canonical” from functions.php [closed]
- echo custom fields with AJAX
- Function filter breaking tag archive menus
- How to create a functions.php in child theme? [closed]
- wordpress get_post_meta give only first value
- How to echo the value of an array element using a function via a shortcode
- Convert multiple logos into the_custom_logo
- I can’t add CSS with functions.php
- Register_Sidebar overwriting itself and doesn’t exist in global $wp_registered_sidebars;
- Protect get_query_var from manual input in url
- widgets not working
- Shortcode to get featured image of specific id post
- How to place a div inside a function that creates a div
- Echo post title in post
- dynamic enquiry form [closed]
- Fatal error: allowed memory size when after using enqueue_script
- How would I make a function to dynamically determine if user is logged to change navigation menu text?
- How to redirect Subscribers on login to specific page, when logging in from a Page
- how can I add filter in specfic field in my website?
- How to change images url in function.php?
- Which filter fires upon setting a featured image
- Probleme shortcode with list author
- Stylesheet does not load despite functions.php
- How to customize archive widget only for cpt?
- How to show only specific category post by user role without plugin and restrict all other cats
- Shortcode to output category description by passing ID
- some profile informations like youtube link doesnt seem
- Help using ShortCodes to style whole chunks of the post
- How to modify or override a core function (wp_star_rating)
- Removing sanitize_title_with_dashes Function with The Real Title
- Is there is a way to check daily first login?
- Printing medium sized image
- Filter posts on new page
- Sticky – Featured Image
- WordPress Jquery+scripts enqueue issue
- Adding a jQuery rotator function
- How to pass a variable from a template page to the child theme functions.php
- Home/Static Page View for Visitors pages after that should be restricted
- functions.php filters not applied in AJAX call
- Settings in functions.php used by a plugin
- Make WordPress search for only this tags or exclude certain tags from search [duplicate]
- Can’t change excerpt length and more tag
- Echo a div to header.php from functions.php
- Making an under maintenance page (without using plugins)
- Image width issue in IE [closed]
- Changed functions.php file and now site is blank [closed]
- Vimeo video play button color function
- User’s Comments Number: Storing it in a meta field for different uses
- Show one post per author and order by custom field
- How Do I Prevent Featured Image Caption Displaying Above And Below Image