Programmatically creating site in a network

You’re using $user_id = get_option( ‘admin_email’ ); and then using that $user_id. However, get_option( ‘admin_email’ ); returns an email address, not the int that wpmu_create_blog() expects. So your sites are (presumably) being created with a user_id of 0. Here’s how I’d address this: $user_email = get_option(‘admin_email’); $user_object = get_user_by( ’email’, $user_email ); if ( false … 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()

How to wordpress multi site [closed]

I think to explain it all here is a bit beyond the scope. Perhaps it is best to start here, and then you can ask detailed questions if you encounter problems:https://www.wpbeginner.com/wp-tutorials/how-to-install-and-setup-wordpress-multisite-network

How to exclude specified from all list of Multisite

I’d recommend using get_sites() instead of crafting $wpdb calls. Add this code to your theme’s functions.php file. function wpse365255_print_sites() { $args = array( ‘number’ => 10000, // if you’ve got more than 10,000 sites, //you can increase this ‘public’ => 1, ‘spam’ => 0, ‘deleted’ => 0, ‘archived’ => 0, ‘site__not_in’ => array( 1, 2 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)