Multisite – One Site with multiple URLs

Short answer is – this is possible and easily achievable by using JJJ’s plugin https://wordpress.org/plugins/wp-multi-network/. Long answer is – WordPress allows for such structures to be created, but does require some hacking in order to make it right if you decide to do it manually. The original database structure of a multisite website is prepared … Read more

WordPress Multisite (sub-directory based), change subsite URL

If you go to your Network Admin -> Sites menu, you should be able to edit the site and change the site’s Site Address (URL) to whatever you need it to be. As for the search/replace: I recommend using WP-CLI’s search-replace command to do this, if you’ve got it available. wp search-replace https://example.com/site-1/ https://example.com/site-2 –url=https://example.com/site-1 … Read more

Multisite foreach loop returning only one result

Each pass through the foreach() loop, you’re wiping out the values that are already in your $urls array. Try something like this: function rel_alternate_network(){ global $post; $slugX = is_main_site() ? $post->post_name : rtrim($post->post_name, ‘-in-‘.strtolower(do_shortcode(‘[country]’))); $urls = array(); foreach(get_sites() as $site){ if( $site->blog_id == get_current_blog_id()) {continue;} switch_to_blog($site->blog_id); $slugY = get_post_by_slug($slugX); $new_url[‘site’] = $site->path; $new_url[‘slug’] = $slugY->post_name; … Read more

How do I disable XML-RPC in WordPress Multisite?

The simplest solution is a rule inside the .htaccess of the installation, if it is an Apache server. The following syntax should support you. Protect the whole access # PROTECT xmlrpc.php <Files xmlrpc.php> Order Allow,Deny Deny from all </Files> Access for several apps # ACCESS for xmlrpc surface only for different apps <IfModule mod_setenvif.c> <Files … Read more

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