{"id":16,"date":"2012-08-26T21:02:24","date_gmt":"2012-08-26T21:02:24","guid":{"rendered":"http:\/\/eoghan.me.uk\/notes\/?p=16"},"modified":"2012-08-31T19:14:37","modified_gmt":"2012-08-31T19:14:37","slug":"dismantle-wp-network","status":"publish","type":"post","link":"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/","title":{"rendered":"Dismantle WordPress &#8216;Network of Sites&#8217;"},"content":{"rendered":"<h1>Dismantling a WordPress &#8216;Network of Sites&#8217;, to extract a single site.<\/h1>\n<p>Recently I set up a WordPress &#8216;Network of Sites&#8217; &#8211; but then realised I only really wanted a single-site install. This post details how I converted it into a single-site install.<!--more--><\/p>\n<h2>Disclaimers<\/h2>\n<ul>\n<li>This seemed to work on the &#8216;subdirectory&#8217; Network of Sites install I had set up, but it hasn&#8217;t been tested on a &#8216;subdomain&#8217; set-up.<\/li>\n<li>You may have plugins installed that may not work properly afterwards.<\/li>\n<li>BACK UP your SITE FILES and DATABASE before attempting this.<\/li>\n<li>This may break everything &#8211; make sure you have a good backup (and preferably make all your changes in a local server install)<\/li>\n<\/ul>\n<h2>Online information<\/h2>\n<p>If site you want to keep in your Network of Sites is the main site, then one of the following links will help you to convert it to a single-site install. But if the site you want to keep is a sub-site you added to your Network of Sites, then see if the rest of this post is any use.<\/p>\n<ul>\n<li><a href=\"http:\/\/www.dummies.com\/how-to\/content\/how-to-disable-a-wordpress-network.html\" rel=\"nofollow\">How to Disable a WordPress Network<\/a><\/li>\n<li><a href=\"http:\/\/jgwebdevelopment.com\/2011\/03\/22\/how-to-uninstall-wordpress-multi-site\/\">How to uninstall WordPress Multi-Site<\/a><\/li>\n<li><a href=\"http:\/\/wpmututorials.com\/how-to\/how-to-disable-multisite\/\">How to disable multisite<\/a><\/li>\n<li><a href=\"http:\/\/wordpress.org\/support\/topic\/can-i-remove-a-site-from-network-admin-to-be-standalone\" rel=\"nofollow\">Can I remove a site from Network admin to be standalone?<\/a><\/li>\n<\/ul>\n<h2>1. Preparation<\/h2>\n<ol>\n<li>Note part of the URL for the site you want to keep<br \/>\ne.g. my site was in &#8216;www.something.co.uk\/<strong>wp\/identify\/<\/strong>&#8216;<\/li>\n<li>Note the &#8216;blog number&#8217; of the site you want to keep<br \/>\nIn my &#8216;Network of Sites&#8217; install, the site I wanted to keep was #<strong>2<\/strong> (i.e. with database tables &#8216;wp_2_options&#8217; etc.)<br \/>\nIf the blog you want to keep is the main one (i.e. not &#8216;_2&#8217;, &#8216;_3&#8217; etc.) then the links in the &#8216;Online information&#8217; section above are probably all you need.<\/li>\n<\/ol>\n<h3>1b. Back up<\/h3>\n<p>Back up all your sites files, and its full MySQL database.<\/p>\n<h2>2. Extracting a single site<\/h2>\n<h3>2a. Top-level wp-config.php file<\/h3>\n<ol>\n<li>Visit the Network Admin Dashboard &#8216;\/wp-admin\/network\/&#8217;<\/li>\n<li>From the &#8216;Settings&#8217; menu, choose &#8216;Network Setup&#8217;<\/li>\n<li>Use the displayed information as a guide to to <strong>remove<\/strong> the Network code from your top-level &#8216;wp-config.php&#8217; file.<\/li>\n<li>Remove the &#8216;define(&#8216;WP_ALLOW_MULTISITE&#8217;, true);&#8217; line from your &#8216;wp-config.php&#8217; file.<\/li>\n<\/ol>\n<h3>2b. Top-level .htaccess file<\/h3>\n<p>When you set up your network, you replaced all previous code in your .htaccess file with the code in &#8216;Network Setup&#8217;.<\/p>\n<p>If you have a backup of the .htaccess file from before you enabled the &#8216;Network of Sites&#8217;, then reinstate it.<\/p>\n<p>Or you could try deleting the file completely, if you didn&#8217;t need to add any code to it yourself.<\/p>\n<h3>2c. The blogs.dir directory<\/h3>\n<p>When you set up a Network of Sites, you add a new directory inside &#8216;wp-content&#8217; named &#8216;blogs.dir&#8217; to hold uploaded files.<\/p>\n<p>To convert that structure back to the Single Site setup, remember which &#8216;blog number&#8217; you want to convert (e.g. in the following I&#8217;m converting blog number 2), then:<\/p>\n<ul>\n<li>Find the &#8216;\/wp-content\/blogs.dir\/2\/files&#8217; directory<\/li>\n<li>Move that final &#8216;files&#8217; directory into the &#8216;\/wp-content&#8217; directory.<\/li>\n<li>Delete the &#8216;blogs.dir&#8217; directory<\/li>\n<\/ul>\n<p>So you should end up with the following structure:<\/p>\n<ul>\n<li>&#8216;\/wp-content\/files\/<em>2012\/08\/&#8230;<\/em>&#8216;<\/li>\n<\/ul>\n<h2>3. Database<\/h2>\n<p>Open the database associated with your install in phpMyAdmin.<\/p>\n<h3>3a. Delete tables<\/h3>\n<p>Delete the following tables:<\/p>\n<ol>\n<li>wp_blogs<\/li>\n<li>wp_blog_versions<\/li>\n<li>wp_registration_log<\/li>\n<li>wp_signups<\/li>\n<li>wp_site<\/li>\n<li>wp_sitemeta<\/li>\n<\/ol>\n<p>(The purpose of each of these tables is noted in <a href=\"http:\/\/www.dummies.com\/how-to\/content\/how-to-disable-a-wordpress-network.html\" rel=\"nofollow\">How to Disable a WordPress Network<\/a>.)<\/p>\n<p>Also delete the following &#8216;base&#8217; tables (as we are going to rename all the &#8216;wp_2_commentmeta&#8217; etc. tables to be the base tables &#8216;wp_commentmeta&#8217; etc.)<\/p>\n<ol>\n<li>wp_commentmeta<\/li>\n<li>wp_comments<\/li>\n<li>wp_links<\/li>\n<li>wp_options<\/li>\n<li>wp_postmeta<\/li>\n<li>wp_posts<\/li>\n<li>wp_terms<\/li>\n<li>wp_term_relationships<\/li>\n<li>wp_term_taxonomy<\/li>\n<\/ol>\n<h3>3b. Rename tables<\/h3>\n<p>Find all the tables containing the &#8216;blog number&#8217; you want to convert (e.g. &#8216;wp_2_commentmeta&#8217;) and remove the &#8216;2_&#8217; from each one.<\/p>\n<p>To rename a table in phpMyAdmin:<\/p>\n<ol>\n<li>Open the table<\/li>\n<li>Click &#8216;Operations&#8217;<\/li>\n<li>Rename the table in the &#8216;Table options&#8217; section<\/li>\n<li>Click &#8216;Go&#8217; in that section<\/li>\n<\/ol>\n<h3>3c. Find and replace<\/h3>\n<p>The safest way to alter values in the database seems to be to download the <a href=\"http:\/\/interconnectit.com\/124\/search-and-replace-for-wordpress-databases\/\" rel=\"nofollow\">Search and Replace for WordPress Databases Script<\/a>, and follow the instructions to find and replace values.<\/p>\n<h4>3b i. File paths<\/h4>\n<p>You need to change the file paths of files that were previously in the &#8216;blogs.dir&#8217; structure.<\/p>\n<p>Bearing in mind that the &#8216;blog number&#8217; I want to make into a Single Site is number 2, I did the following:<\/p>\n<p>In the &#8216;wp_posts&#8217; and &#8216;wp_options&#8217; tables:<\/p>\n<ul>\n<li>Find &#8216;wp\/identify\/files&#8217;, replace with &#8216;wp\/wp-content\/files&#8217;<\/li>\n<\/ul>\n<p>In the &#8216;wp_options&#8217; table:<\/p>\n<ul>\n<li>Find &#8216;blogs.dir\/2\/files&#8217;, replace with &#8216;files&#8217;<\/li>\n<\/ul>\n<h4>3c i. URLs<\/h4>\n<p>Update any instance of the old sub-directory URL in the database, with the top-level directory.<\/p>\n<p>Bearing in mind my &#8216;blog URL&#8217; was &#8216;www.something.co.uk\/wp\/identify&#8217;, I did the following:<\/p>\n<p>In all tables:<\/p>\n<ul>\n<li>Find &#8216;wp\/identify&#8217;, replace with &#8216;wp&#8217;<\/li>\n<\/ul>\n<p>So old URLs of the type &#8216;www.something.co.uk\/wp\/identify\/2012\/&#8230;&#8217; would become &#8216;www.something.co.uk\/wp\/2012\/&#8230;&#8217;<\/p>\n<h4>3c ii. Fields<\/h4>\n<p>You also need to do a find and replace on some meta_key values in the database.<\/p>\n<p>Bearing in mind that the &#8216;blog number&#8217; I want to make into a Single Site is number 2, I did the following:<\/p>\n<p>In the &#8216;wp_usermeta&#8217; table:<\/p>\n<ul>\n<li>Find &#8216;wp_2_capabilities&#8217;, replace with &#8216;wp_capabilities&#8217;<\/li>\n<li>Find &#8216;wp_2_user_level&#8217;, replace with &#8216;wp_user_level&#8217;<\/li>\n<li>Find &#8216;wp_2_user-settings&#8217;, replace with &#8216;wp_user-settings&#8217;<\/li>\n<li>Find &#8216;wp_2_user-settings-time&#8217;, replace with &#8216;wp_user-settings-time&#8217;<\/li>\n<li>Find &#8216;wp_2_dashboard_quick_press_last_post_id&#8217;, replace with &#8216;wp_dashboard_quick_press_last_post_id&#8217;<\/li>\n<\/ul>\n<p>In the &#8216;wp_options&#8217; table:<\/p>\n<ul>\n<li>Find &#8216;wp_2_user_roles&#8217;, replace with &#8216;wp_user_roles&#8217;<\/li>\n<\/ul>\n<h2>4. Refresh Permalinks<\/h2>\n<p>Finally, log into the Admin side of the site.<\/p>\n<ol>\n<li>Choose &#8216;Settings&#8217;, then &#8216;Permalinks&#8217;<\/li>\n<li>Note the current setting<\/li>\n<li>Switch to a different setting (e.g. &#8216;Default), and &#8216;Save Changes&#8217;<\/li>\n<li>Switch back to the original setting, and &#8216;Save Changes&#8217;<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Dismantling a WordPress &#8216;Network of Sites&#8217;, to extract a single site. Recently I set up a WordPress &#8216;Network of Sites&#8217; &#8211; but then realised I only really wanted a single-site install. This post details how I converted it into a single-site install.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-16","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Dismantle a WordPress Network of Sites<\/title>\n<meta name=\"description\" content=\"Some notes on how to dismantle a Wordpress Network of Sites, and extract a single site from it.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dismantle a WordPress Network of Sites\" \/>\n<meta property=\"og:description\" content=\"Some notes on how to dismantle a Wordpress Network of Sites, and extract a single site from it.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/\" \/>\n<meta property=\"og:site_name\" content=\"Eoghan&#039;s Notes\" \/>\n<meta property=\"article:published_time\" content=\"2012-08-26T21:02:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-08-31T19:14:37+00:00\" \/>\n<meta name=\"author\" content=\"Eoghan\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eoghan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/\",\"url\":\"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/\",\"name\":\"Dismantle a WordPress Network of Sites\",\"isPartOf\":{\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#website\"},\"datePublished\":\"2012-08-26T21:02:24+00:00\",\"dateModified\":\"2012-08-31T19:14:37+00:00\",\"author\":{\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800\"},\"description\":\"Some notes on how to dismantle a Wordpress Network of Sites, and extract a single site from it.\",\"breadcrumb\":{\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eoghan.me.uk\/notes\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Dismantle WordPress &#8216;Network of Sites&#8217;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#website\",\"url\":\"https:\/\/eoghan.me.uk\/notes\/\",\"name\":\"Eoghan&#039;s Notes\",\"description\":\"The odd note that might come in handy someday\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/eoghan.me.uk\/notes\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800\",\"name\":\"Eoghan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g\",\"caption\":\"Eoghan\"},\"url\":\"https:\/\/eoghan.me.uk\/notes\/author\/eoghan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Dismantle a WordPress Network of Sites","description":"Some notes on how to dismantle a Wordpress Network of Sites, and extract a single site from it.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/","og_locale":"en_GB","og_type":"article","og_title":"Dismantle a WordPress Network of Sites","og_description":"Some notes on how to dismantle a Wordpress Network of Sites, and extract a single site from it.","og_url":"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/","og_site_name":"Eoghan&#039;s Notes","article_published_time":"2012-08-26T21:02:24+00:00","article_modified_time":"2012-08-31T19:14:37+00:00","author":"Eoghan","twitter_misc":{"Written by":"Eoghan","Estimated reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/","url":"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/","name":"Dismantle a WordPress Network of Sites","isPartOf":{"@id":"https:\/\/eoghan.me.uk\/notes\/#website"},"datePublished":"2012-08-26T21:02:24+00:00","dateModified":"2012-08-31T19:14:37+00:00","author":{"@id":"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800"},"description":"Some notes on how to dismantle a Wordpress Network of Sites, and extract a single site from it.","breadcrumb":{"@id":"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/eoghan.me.uk\/notes\/2012\/08\/26\/dismantle-wp-network\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eoghan.me.uk\/notes\/"},{"@type":"ListItem","position":2,"name":"Dismantle WordPress &#8216;Network of Sites&#8217;"}]},{"@type":"WebSite","@id":"https:\/\/eoghan.me.uk\/notes\/#website","url":"https:\/\/eoghan.me.uk\/notes\/","name":"Eoghan&#039;s Notes","description":"The odd note that might come in handy someday","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eoghan.me.uk\/notes\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800","name":"Eoghan","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g","caption":"Eoghan"},"url":"https:\/\/eoghan.me.uk\/notes\/author\/eoghan\/"}]}},"_links":{"self":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts\/16","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":20,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":39,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts\/16\/revisions\/39"}],"wp:attachment":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/media?parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/categories?post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/tags?post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}