Multisite install on a sub-directory

Install it at the root and use a custom theme for the first site. Specifically, you want a subdirectory install, and then for the root sites theme, replace the contents of index.php with that of your static html page. You’ll need a style.css with a comment at the top so WP picks it up as … Read more

Get posts by user role in a Multisite

global $switched; switch_to_blog(2); //switched to your site id based on which site post need. $administrators = get_users( array( ‘role’ => ‘administrator’ ) ); // you can add more role on same query add with “,” separated. $administrators_ids = array(); $original_blog_id = get_current_blog_id(); foreach( $administrators as $admin ): $administrators_ids[] = $admin->ID; $news = new WP_Query( array( … Read more

WordPress multi-domain with multiple sites with multiple languages

Struggled for days to solve a similar problem. Tried Polylang, WPML, all sorts of custom codes. Did some research on domaining and languages. I have started with subdomains. myfancysite.com, then adding de.myfancysite.com, it.myfancysite.com etc. Then I have realized I’m losing some potential. Came up with some conclusion: Spreading multilanguage project on ccTLDs is more expensive … Read more

Update siteurl and home in multisite subsites to https

Solved: Add these code to the functions.php file of your subsite’s theme, immediately after the initial ” AND READ THIS, BEFORE USING: https://codex.wordpress.org/Changing_The_Site_URL#Edit_functions.php if ( ! is_admin() ) { $xsiteurl = get_option( ‘home’ ); $find = array( ‘http://’, ‘https://’ ); if ( $find != ‘http://’ ) { $replace=””; $pureaddress = str_replace( $find, $replace, $xsiteurl ); … Read more

How to Add Super Admin for WordPress multi-site

More information for how to manage user manually Manage This settings if ( $newpassword != ‘ ‘ && $newemail != ‘ ‘ && $newusername !=’ ‘ ) { if ( !username_exists($newusername) && !email_exists($newemail) ) { $user_id = wp_create_user( $newusername, $newpassword, $newemail); if ( is_int($user_id) ) { $wp_user_object = new WP_User($user_id); $wp_user_object->set_role(‘administrator’); grant_super_admin($user_id); // Grants Super … Read more