![]()
Windows Live Writer (download) 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.
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.
The result is an Internet littered with Temporary Posts Used For Theme Detection.
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 ever appearing on your website.
<?php
/*
Plugin Name: Orzeszek Live Writer Helper
Plugin URI: http://www.orzeszek.org/blog/
Version: 1.0
Author: Orzeszek
Author URI: http://www.orzeszek.org/blog/
Description: Prevents the Temporary Post Used For Theme Detection from ever appearing on your blog.
*/
function orz_posts_where($where)
{
if(!is_admin() && strpos($_SERVER['HTTP_USER_AGENT'],
'Windows Live Writer') === false)
{
if ($where != '')
$where .= ' AND ';
$where .= 'post_title NOT LIKE ' .
'\'Temporary Post Used For % Detection (%)\'';
}
return $where;
}
add_filter('posts_where', 'orz_posts_where');
?>
Create a new text file called orz-live-writer-helper.php. Copy and paste the above code into that text file, and save it.
Make sure that the very first characters in orz-live-writer-helper.php are <? and that the very last characters are ?>. If they’re not (for instance, if you have a space after ?>), you may get a ‘Warning: Cannot modify header information – headers already sent…’ message. More info.
Create a new directory called orz-live-writer-helper in your wp-content/plugins directory, and upload orz-live-writer-helper.php to the new directory. Finally, activate the plugin by logging into WordPress as an administrator, selecting Plugins from the menu, and selecting Activate for the Orzeszek Live Writer Helper plugin.
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.
You can still view the post when logged into the management interface (ie, when logged into wp-admin), 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.
Hopefully, this will end the flood of Temporary Posts Used For Theme Detection, at least on WordPress blogs.
Note: 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 (*)’.
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 % is a wildcard in the SQL WHERE clause.)

{ 4 comments… read them below or add one }
Hi, there.
I uploaded your plugin and activated it. Then I tested it by trying to publish “Temporary Post Used for Theme Detection” headline via Live Writer. It went published…
Did I miss something?
Thanks in advance.
Maybe. When Windows Live Writer publishes one of its temporary detection posts, the title is Temporary Post Used For Theme Detection ([random characters]). The plugin only stops posts in the form Temporary Post Used For Theme Detection (*) from appearing on your site.
The plugin doesn’t eliminate posts that just contain the words ‘Temporary Post Used For Theme Detection’ because you might want to write about these temporary posts, and in that case your title would probably contain those words.
Try publishing a post titled ‘Temporary Post Used For Theme Detection (abc)‘. Does that still appear?
It works!
The post didn’t get published. On the other hand, It’s seen via the management interface, just as you wrote.
I bow my head to the ground.
:)
Thanks again!
You’re welcome. :-)