Handling single.php in Multisite

I’m surprised get_current_blog_id() didn’t work, since that’s probably the best way to approach it. Always try doing a var_dump( $current_blog ) to make sure you’re testing for what you need. Edit (19 Aug 2015): Also, triple check that you know which header you’re expecting to see and that you’re making the change you want in … Read more

How do I check if the user is a site owner in a network?

I have had similar issues with this in the past, WordPress really does need a is_user_admin() function. In the meantime I think the best way to do this is to test if the user has certain capabilities. function is_user_admin(){ if(!is_super_admin() && current_user_can(‘activate_plugins’){ // User is an admin } } Reference: Administrator roles current_user_can()

Copy user role on multisite so the user can access subsites with same role

You can use the below function to copy all the users to all the subsite. It’s actually getting all the user IDs and subsites IDs first, then it’s looping over every sites and users to assign all the users to every subsite. Here is the updated code- add_action(‘wp’,’the_dramatist_add_current_user_to_site’); function the_dramatist_add_current_user_to_site() { global $wpdb; $all_users = … Read more

use get_theme_mod from all sites in network

You will have to switch to your blog using switch_to_blog( $blog->blog_id ); and the access the data you want from that blog. switch_to_blog( $blog->blog_id ); get_theme_mod(‘your_key’); This should give you customizer option data for that blog. Also I’m not sure where you are using this code, but instead of using wpdb query you can use … Read more