Make CSS style only display for admins and below

How can I remove, coursepress notice for administrators and not super admin?

I have added this code here:
https://simplylearn.no/wp-admin/network/admin.php?page=branding&tab=css
.notice.notice-warning.is-dismissible.coursepress-upgrade-nag {
display: none; }
Is works, but this removes the notice form the super admin as well and that is not workable.
How can we setup the branding plugin to only do that for site admins and not super admin?

  • Adam Czajczyk

    Hello morfjord,

    I hope you're well today and thank you for your question!

    The Ultimate Branding "CSS" tool currently doesn't support "role-based" switching. The "Admin CSS" option refers to "admin area" rather than to "admin user role" therefore there's no option to check if a current user is an admin or a super-admin.

    The solution here would be to output custom CSS with the code that would a) print style only in admin area and b) prior to that check if a current user is a super-admin. This code should do the work:

    <?php 
    
    function wpmu_admin_side_role_based_style() {
    
    	if (!is_super_admin()) {
    	?>
    	<style>
                     YOUR_CSS_HERE
     	</style>
    	<?php
    	}
    }
    
    add_action('admin_footer', 'wpmu_admin_side_role_based_style');

    In order to apply it to your multisite, please create an empty file with a .php extension and past this code inside. Make sure that you replaced the "YOUR_CUSTOM_CSS" placeholder with your CSS rules and then upload the file to the "/wp-content/mu-plugins" folder of your WordPress Multisite.

    I hope that helps!
    Best regards,
    Adam