<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WP Engineer &#187; uninstall</title>
	<atom:link href="http://wpengineer.com/tag/uninstall/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpengineer.com</link>
	<description>WordPress News, Hacks, Tips, Tutorials, Plugins and Themes</description>
	<lastBuildDate>Mon, 21 May 2012 22:48:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Remove WordPress Multisite Feature &#8211; ToDo List!</title>
		<link>http://wpengineer.com/2056/remove-wordpress-multisite-feature-todo-list/</link>
		<comments>http://wpengineer.com/2056/remove-wordpress-multisite-feature-todo-list/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 11:10:41 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Multisite]]></category>
		<category><![CDATA[uninstall]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>
		<category><![CDATA[WP3.0]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2056</guid>
		<description><![CDATA[You can activate the Multisite functionality of WordPress relatively quick and it is well explaind in the backend how to do it. But not always you like to keep it as a multi site installation and therefore you have to do some measures to remove the Network function again. Not easy and probably not an [...]]]></description>
			<content:encoded><![CDATA[<p>You can activate the <a href="http://codex.wordpress.org/Create_A_Network">Multisite functionality</a> of WordPress relatively quick and it is well explaind in the backend how to do it. But not always you like to keep it as a multi site installation and therefore you have to do some measures to remove the Network function again.</p>
<p>Not easy and probably not an every day task - so that's why I created a small todo list in order not to forget a step to restore to the default installation.<br />
<span id="more-2056"></span></p>
<ol>
<li><strong>Save all your data</strong> - Database and files via FTP</li>
<li>Set the constant <code>WP_ALLOW_MULTISITE</code> to <code>FALSE</code> or delete the definition</li>
<li>Remove the following line in your <code>wp-config.php</code>; Just comment out is enough.
<pre>
/**
define( &#039;MULTISITE&#039;, true );
define( &#039;SUBDOMAIN_INSTALL&#039;, false );
$base = &#039;/wordpress/&#039;;
define( &#039;DOMAIN_CURRENT_SITE&#039;, &#039;localhost&#039; );
define( &#039;PATH_CURRENT_SITE&#039;, &#039;/wordpress/&#039; );
define( &#039;SITE_ID_CURRENT_SITE&#039;, 1 );
define( &#039;BLOG_ID_CURRENT_SITE&#039;, 1 );
*/
</pre>
</li>
<li>Remove the entries for the network in your <code>.htaccess</code> which is in the root of your installation
<pre>
# BEGIN WordPress
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - &#091;L&#093;

# uploaded files
RewriteRule ^(&#091;_0-9a-zA-Z-&#093;+/)?files/(.+) wp-includes/ms-files.php?file=$2 &#091;L&#093;

# add a trailing slash to /wp-admin
RewriteRule ^(&#091;_0-9a-zA-Z-&#093;+/)?wp-admin$ $1wp-admin/ &#091;R=301,L&#093;

RewriteCond %{REQUEST_FILENAME} -f &#091;OR&#093;
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - &#091;L&#093;
RewriteRule  ^(&#091;_0-9a-zA-Z-&#093;+/)?(wp-(content|admin|includes).*) $2 &#091;L&#093;
RewriteRule  ^(&#091;_0-9a-zA-Z-&#093;+/)?(.*\.php)$ $2 &#091;L&#093;
RewriteRule . index.php &#091;L&#093;
# END WordPress
</pre>
</li>
<li>Now recreate the permalinks and add the necessary lines to <code>.htaccess</code> (<code>wp-admin/options-permalink.php</code>)</li>
<li>Remove the fields <code>spam</code> and <code>deleted</code> in the user-table (adjust prefix)
<pre>
ALTER TABLE `wp_users` DROP `spam`, DROP `deleted`;
</pre>
</li>
<li>You can delete the following tables in your database (adjust prefix)
<ul>
<li>wp_blogs</li>
<li>wp_blog_versions</li>
<li>wp_registration_log</li>
<li>wp_signups</li>
<li>wp_site</li>
<li>wp_sitemeta</li>
<li>wp_sitecategories (if global terms were active)
<pre>
DROP TABLE
    `wp_blogs`,
    `wp_blog_versions`,
    `wp_registration_log`,
    `wp_signups`,
    `wp_site`,
    `wp_sitemeta`,
    `wp_sitecategories`;
</pre>
</li>
</ul>
</li>
<li>Now you have your default installation of your default blog back. But in your database there are still tables of the 2nd created blog. You have to check if you need some information of this former blog. If not, you can also delete the tables of the former 2nd blog.</li>
</ol>
<p>Just remember: Before proceeding I really recommend to create a backup.<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2056/remove-wordpress-multisite-feature-todo-list/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin Deinstall Data Automatically</title>
		<link>http://wpengineer.com/35/wordpress-plugin-deinstall-data-automatically/</link>
		<comments>http://wpengineer.com/35/wordpress-plugin-deinstall-data-automatically/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 17:49:27 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[uninstall]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp2.7]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=35</guid>
		<description><![CDATA[In version 2.7 of WordPress you will have the possibility to delete a Plugin directly in your backend, see version 2.7 info. To delete also the Plugin data from your database, the Plugin author has to accomplish some requirements. I hope the following tutorial will help some Plugin authors and they will implement this feature [...]]]></description>
			<content:encoded><![CDATA[<p>In version 2.7 of WordPress you will have the possibility to delete a Plugin directly in your backend, see <a href="http://codex.wordpress.org/Version_2.7#Plugin_Uninstaller">version 2.7 info</a>. To delete also the Plugin data from your database, the Plugin author has to accomplish some requirements. I hope the following tutorial will help some Plugin authors and they will implement this feature in their current or future Plugins.<br />
<span id="more-35"></span><br />
<img src="http://wpengineer.com/wp-content/uploads/wp27_delete.png" alt="since version 2.7 you can delete Plugins directly in your WordPress backend" width="243" height="105" class="alignnone size-full wp-image-117" /></p>
<p>Everybody who had the uninstall function in their Plugin, doesn&#8217;t have to change a lot. For everybody who likes to know, you can find the function for uninstall in <code>wp-admin/includes/plugin.php</code></p>
<ol>
<li><code>is_uninstallable_plugin($plugin)</code></li>
<li><code>uninstall_plugin($plugin)</code></li>
</ol>
<p>and the associated hook <code>wp-includes/plugin.php</code></p>
<ol>
<li><code>register_uninstall_hook($file, $callback)</code></li>
</ol>
<p>You can use <strong>two possibilities</strong> to add the additional function.</p>
<ol>
<li>A file with the name <code>uninstall.php</code> has to be in the Plugin.</li>
<li>A hook for uninstall <code>register_uninstall_hook</code> has to talk to.</li>
</ol>
<p>Up to Version 2.7 you were also able to delete the data from the database, but only if you deactivated the Plugin (Hook <code>register_deactivation_hook()</code>) or with help of a formular. </p>
<p>To use also other versions of WordPress, I suggest to use the constant <code>WP_UNINSTALL_PLUGIN</code>, because this one exists in version 2.7. Alternative you can use the hook <code>register_uninstall_hook()</code>, since this one is necessary to function via hook. Both possibles are listed in the following examples.</p>
<p><img src="http://wpengineer.com/wp-content/uploads/wp27_delete2.png" alt="in version 2.7 you can delete Plugins directly in your backend" width="450" height="284" class="alignnone size-full wp-image-118" /></p>
<p>The following function for example should be in the Plugin and deleting the entry <em>example</em> from the database table <code>options</code>.</p>
<pre lang="php">
/**
 * Delete options in database
 */
function example_deinstall() {

	delete_option(&#039;example&#039;);
}
</pre>
<h3>via Data <code>uninstall.php</code></h3>
<p>Easiest possibility is to create the file <code>unistall.php</code> with according entries to delete data in the table <code>options</code>.</p>
<pre lang="php">
delete_option(&#039;example&#039;);
</pre>
<p>To avoid an error in older WordPress versions, I recommend to use a constant. Isn&#8217;t there a constant defined, it will just stop in this example.</p>
<pre lang="php">
if ( !defined(&#039;WP_UNINSTALL_PLUGIN&#039;) ) {
    exit();
}
delete_option(&#039;example&#039;);
</pre>
<h3>via hook <code>register_uninstall_hook()</code></h3>
<p>Alternatively you can register the deinstallation via hook, so that you are not depend on the file and you can use a easier possibility to integrate an uninstallation in your Plugin. For that you can use the hook <code>register_uninstall_hook()</code>.</p>
<pre lang="php">
 /**
 * Check for hook
 */
if ( function_exists(&#039;register_uninstall_hook&#039;) )
	register_uninstall_hook(__FILE__, &#039;example_deinstall&#039;);

 /**
 * Delete options in database
 */
function example_deinstall() {

	delete_option(&#039;example&#039;);
}
</pre>
<p>The possibility, to delete Plugins directly in your backend, certainly makes it easier for the user to get rid off unused data. But for that, the Plugin authors have to support this feature and the table  <code>options</code> certainly will be thankful for that.<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/35/wordpress-plugin-deinstall-data-automatically/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

