<?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>Orzeszek Blog &#187; Windows Live Writer</title>
	<atom:link href="http://www.orzeszek.org/blog/tag/windows-live-writer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.orzeszek.org/blog</link>
	<description>An inchoate upside-down perspective</description>
	<lastBuildDate>Sun, 25 Jul 2010 03:21:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Get Rid of Temporary Posts Used for Theme Detection Permanently</title>
		<link>http://www.orzeszek.org/blog/2009/11/17/how-to-get-rid-of-temporary-posts-used-for-theme-detection-permanently/</link>
		<comments>http://www.orzeszek.org/blog/2009/11/17/how-to-get-rid-of-temporary-posts-used-for-theme-detection-permanently/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 08:52:18 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Windows Live Writer]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress plugins]]></category>

		<guid isPermaLink="false">http://www.orzeszek.org/blog/?p=929</guid>
		<description><![CDATA[Windows Live Writer is an exceptional tool for blogging. But it relies on an inelegant mechanism to detect the theme used by your blog. The result is an Internet littered with Temporary Posts Used For Theme Detection. Thankfully, you can use a WordPress plugin to prevent these posts from ever appearing on your website.]]></description>
			<content:encoded><![CDATA[<p></p><p><img src="http://www.orzeszek.org/blog/wp-content/uploads/2009/11/live-writer-icon.png" alt="Windows Live Writer icon" title="Windows Live Writer icon" width="128" height="128" class="alignright size-full wp-image-948 orz-img-no-border" /></p>
<p><span class="drop_cap">W</span>indows Live Writer (<a href="http://download.live.com/writer">download</a>) is an exceptional tool for blogging. But its most useful feature, WYSIWYG editing, relies on an inelegant mechanism to detect the theme used by your blog.</p>
<p>To detect the theme, Windows Live Writer will publish a skeleton post to your blog, read it and save its theme, and then delete it. Sometimes the post isn’t deleted. Other times, it’s indexed by Google, FeedBurner, or other similar services before it’s deleted.</p>
<p>The result is an Internet <a href="http://www.google.com/search?q=Temporary%20Post%20Used%20For%20Theme%20Detection">littered</a> with Temporary Posts Used For Theme Detection.</p>
<p>Obsessive compulsives like me don’t want these posts associated with their blogs. Thankfully, it turns out that you can write a plugin for WordPress to prevent these posts from <em>ever</em> appearing on your website.</p>
<div class="orz-codeblock">
<p><code>&lt;?php<br />
      /*<br />
      Plugin Name: Orzeszek Live Writer Helper<br />
      Plugin URI: http://www.orzeszek.org/blog/<br />
      Version: 1.0<br />
      Author: Orzeszek<br />
      Author URI: http://www.orzeszek.org/blog/<br />
      Description: Prevents the Temporary Post Used For Theme Detection from ever appearing on your blog.<br />
      */</code></p>
<p><code>function orz_posts_where($where)<br />
      {<br />
      &#160;&#160; if(!is_admin() &amp;&amp; strpos($_SERVER['HTTP_USER_AGENT'],<br />
      &#160;&#160;&#160;&#160;&#160; 'Windows Live Writer') === false)<br />
      &#160;&#160; {<br />
      &#160;&#160;&#160;&#160;&#160; if ($where != '')<br />
      &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $where .= ' AND ';</code></p>
<p><code>&#160;&#160;&#160;&#160;&#160; $where .= 'post_title NOT LIKE ' .<br />
      &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; '\'Temporary Post Used For % Detection (%)\'';<br />
      &#160;&#160; }<br />
      &#160;&#160; return $where;<br />
      }</code></p>
<p><code>add_filter('posts_where', 'orz_posts_where');<br />
      ?&gt;</code></p>
</div>
<p>Create a new text file called <strong>orz-live-writer-helper.php</strong>. Copy and paste the above code into that text file, and save it.</p>
<p><span id="more-929"></span></p>
<p class="note">Make sure that the very first characters in <strong>orz-live-writer-helper.php</strong> are <strong>&lt;?</strong> and that the very last characters are <strong>?&gt;</strong>. If they’re not (for instance, if you have a space after <strong>?&gt;</strong>), you may get a ‘Warning: Cannot modify header information – headers already sent…’ message. <a href="http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/">More info.</a></p>
<p>Create a new directory called <strong>orz-live-writer-helper</strong> in your <strong>wp-content/plugins</strong> directory, and upload <strong>orz-live-writer-helper.php</strong> to the new directory. Finally, activate the plugin by logging into WordPress as an administrator, selecting <strong>Plugins</strong> from the menu, and selecting <strong>Activate</strong> for the <strong>Orzeszek Live Writer Helper</strong> plugin.</p>
<p>The plugin works by hiding any post where the title is ‘Temporary Post Used For * Detection (*)’ from all pages on your blog, as well as from your RSS feed. Users and bots accessing your site, or your RSS feed, won’t be able to see the temporary post.</p>
<p>You can still view the post when logged into the management interface (ie, when logged into <strong>wp-admin</strong>), so that you can delete the post if it hasn’t been deleted automatically. And, of course, Windows Live Writer can see it too, so that its theme detection engine continues to work.</p>
<p>Hopefully, this will end the flood of Temporary Posts Used For Theme Detection, at least on WordPress blogs.</p>
<p><strong>Note:</strong> The present version of Windows Live Writer creates a post titled ‘Temporary Post Used For Theme Detection (*)’. Old versions created posts titled ‘Temporary Post Used For Style Detection (*)’.</p>
<p>If, in a future release, the title of the temporary post changes to something other than ‘Temporary Post Used For * Detection (*)’, you will need to update the code accordingly. (The <strong>%</strong> is a <a href="http://www.w3schools.com/SQl/sql_wildcards.asp">wildcard</a> in the SQL <a href="http://www.w3schools.com/SQl/sql_where.asp">WHERE</a> clause.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.orzeszek.org/blog/2009/11/17/how-to-get-rid-of-temporary-posts-used-for-theme-detection-permanently/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
