Blog /

WP Multisite – old installation and subdirectory install

The Problem You need to transform your WP site into multisite, and you have already added define (‘WP_ALLOW_MULTISITE’, true); to wp-config.php. But you’ve received the following message: Because your install is not new, the sites in your WordPress network must use sub-domains. The main site in a sub-directory install will need to use a modified…

The Problem

You need to transform your WP site into multisite, and you have already added define (‘WP_ALLOW_MULTISITE’, true); to wp-config.php. But you’ve received the following message:

Because your install is not new, the sites in your WordPress network must use sub-domains. The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.

However, you don’t want to install WP multisite on different subdomains, and you plan to solve the permalinks issue with redirects.

How do you fix it that way? WordPress‘ hidden, built-in function won’t allow you to choose.

The Solution

The solution is quite simple. Just paste the following code snippet into your functions.php:


add_filter( 'allow_subdirectory_install',
create_function( '', 'return true;' )
);

That’s it. Try it, and you should see a radio choice between subdirectory and subdomain install. When you are done with WP Multisite, go ahead and delete the snippet to keep your site clean.