<?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>Blogrescue.com &#187; WordPress</title>
	<atom:link href="http://blogrescue.com/topics/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogrescue.com</link>
	<description>Technical Know-How in Human Terms</description>
	<lastBuildDate>Wed, 01 Feb 2012 20:24:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>The 95 Queries</title>
		<link>http://blogrescue.com/2012/01/the-95-queries/</link>
		<comments>http://blogrescue.com/2012/01/the-95-queries/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 15:31:33 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://blogrescue.com/?p=394</guid>
		<description><![CDATA[No, these are not something nailed to the door of the Wittenberg church. This is the number of queries generated on every page load on a lagging WordPress site I’ve been trying to speed up. The hosting is adequate and they are using a caching plugin and a CDN. They’ve done everything right but something [...]]]></description>
			<content:encoded><![CDATA[<p>No, these are not something nailed to the door of the Wittenberg church.  This is the number of queries generated on every page load on a lagging WordPress site I’ve been trying to speed up.  The hosting is adequate and they are using a caching plugin and a CDN.  They’ve done everything right but something is still very wrong.</p>
<p>A complicated theme will use extra queries and this is acceptable if you need extra loops or recent comments or other special items.  However, the key issue in this case is a theme framework with its significant overhead coupled with a sidebar employing 10 widget sections and over 30 different widgets.</p>
<p>I don’t want to sound like a broken record, but themes that allow the user to change settings within the WordPress interface generate overhead.  Widgets generate additional overhead.  For a high traffic site or even a significant burst of traffic, this can bring a site to its knees. </p>
<div style='width:300px; float:right;margin:5px 0 5px 5px;padding:4px;border:1px solid #ccc;'>
Curious how many queries your theme is generating?  Just add this code to the footer, just above the <code>&lt;/body&gt;</code> tag, load a page from your site and view the source to see how many queries were required to generate the page:</p>
<p><code style='margin:2px 5px;padding:0;color:#555;'>&lt;?php echo $wpdb-&gt;num_queries; ?&gt;<br />
&nbsp;&lt;?php _e('queries'); ?&gt;.<br />
&nbsp;&lt;?php timer_stop(1); ?&gt;<br />
&nbsp;&lt;?php _e('seconds'); ?&gt;</code></p>
<p>Keep in mind that a bare bones vanilla template with no overhead and no widgets and nothing in it at all still yields a baseline of 12 queries.
</p></div>
<p>How can you fix this problem?  Well, optimally, you recode the entire template so it doesn’t use any widgets or settings stored in the database.  Is this painful, expensive and unreasonable?  Yes, yes and no.  What if you are not currently in a place where recoding the template is reasonable?  Well, then you try to optimize what you can and get the query count as low as possible.</p>
<p>Most themes store settings in the WordPress options table and access them using the <a href='http://codex.wordpress.org/Function_Reference/get_option'><code>get_option()</code></a> function.  The theme set I’m trying to salvage uses <code>get_option()</code> 162 times.  Finding a way to reduce the impact of these calls is probably a good place to start.  Simply getting all the theme options in a single query and using cached values instead of reading them when needed should help reduce the number of total queries on each page.</p>
<p>To do this, first we need to figure out how to identify the theme specific options.  Usually there will be a prefix on each option name, so I’ve created a new function in functions.php that reads all the options with that prefix and then I call it:</p>
<pre>
function theme_cache_options($prefix) {
  global $wpdb;
  global $theme_cached_options;

  $sql = "SELECT option_name, option_value FROM ".$wpdb->prefix."options ".
        "WHERE option_name LIKE '%s' AND blog_id = %d";
  $prepared_sql = $wpdb->prepare($sql, $prefix.'%', get_current_blog_id() );
  $theme_cached_options = $wpdb->get_results($prepared_sql, OBJECT_K);
}
theme_cache_options(‘cow_’);
</pre>
<p>Second, we need a function that lets us read the cached option value:</p>
<pre>
function get_cached_option($key) {
  global $theme_cached_options;
  $result = isset($theme_cached_options[$key]) ?
        $result = $theme_cached_options[$key]->option_value : '';
  return $result;
}
</pre>
<p>Finally, we need to go through the theme itself, and change every <code>get_option()</code> call that references a theme setting to <code>get_cached_option()</code>.  Be sure <strong>not</strong> to change any option requests that do not start with the prefix specified in the <code>theme_cache_option()</code> call.</p>
<p>Does this help?  Well, it helps a little.  With the site I’m working on, I’m seeing roughly a 10% reduction in the number of queries.  Worth it?  I think so.</p>
<p><strong>Final note for theme developers:</strong>  If you are going to store theme options in the options table, there is a fourth parameter for the <a href=’ http://codex.wordpress.org/Function_Reference/add_option’><code>add_option()</code></a> function that you should really be aware of.  If you set </code>$autoload</code> to ‘yes’, then WordPress will automatically load and cache that option when it fires up.  This means that <code>get_option()</code> calls for any option that was created with <code>$autoload</code> set to ‘yes’ will not generate any additional queries.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogrescue.com/2012/01/the-95-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Take on WordPress Optimization</title>
		<link>http://blogrescue.com/2011/12/my-take-on-wordpress-optimization/</link>
		<comments>http://blogrescue.com/2011/12/my-take-on-wordpress-optimization/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 17:40:56 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[wordpress optimization]]></category>

		<guid isPermaLink="false">http://blogrescue.com/?p=340</guid>
		<description><![CDATA[Lately, I&#8217;ve seen a huge number of articles on WordPress Optimization being linked to or broadcast on Twitter, and each made one or two good points, but optimization is not simply tweak this or use this plugin. It is a whole course of actions that you should be taking in order to make your WordPress [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I&#8217;ve seen a huge number of articles on WordPress Optimization being linked to or broadcast on Twitter, and each made one or two good points, but optimization is not simply <em>tweak this</em> or <em>use this plugin</em>.  It is a whole course of actions that you should be taking in order to make your WordPress site deliver content as quickly as possible.</p>
<p>I&#8217;ve worked with WordPress since it first came out, and I&#8217;ve supported a number of very high traffic sites.  The items below are what I&#8217;ve learned about making WordPress work better and faster:</p>
<h2>Actions that are Free (or Mostly Free)</h2>
<div style='padding-left:20px;'>
<h3>Use a Caching Plugin</h3>
<p>The two that come to mind are <a href='http://wordpress.org/extend/plugins/wp-super-cache/'>wp-super-cache</a> and <a href='http://wordpress.org/extend/plugins/w3-total-cache/'>w3-total–cache</a> (w3tc).  W3tc does quite a bit more than simply caching content so that gives it the edge, at least in my opinion.  Most WordPress optimization guides start&#8230;and end with implementing a caching plugin, but this is just the first step.</p>
<h3>Homepage Caching</h3>
<p>The most resource intensive page to generate on a wordpress install is usually the homepage and it is also the most viewed page.  By hard caching the homepage every minute via cron and using .htaccess to direct visitors to this static copy, server load can be reduced pretty significantly.  Caching plugins do provide <em>some</em> remedy as far as front page generation and delivery but this is a better solution because it does not even involve starting up php or processing any logic, aside from evaluating a redirect rule.</p>
<h3>Header/Footer/Sidebar Caching</h3>
<p>Some content on a site rarely changes (header, footer, sidebar) so the same strategy described above for the index page can also be employed for other content.  Using cron to regularly grab and store this content and then changing the other templates to include <em>sidebar.inc</em> instead of <em>sidebar.php</em> means generating every page on your side instantly becomes more efficient.  The same works for header.php and footer.php, although keep in mind that the page title should remain dynamic and key actions like wp_head and wp_footer have to be accommodated.</p>
<h3>Minimize Plugins</h3>
<p>Plugins provide many necessary functions and add on features to WordPress.  They also introduce overhead.  The key is to decide what plugins you absolutely need and what features you can either live without or handle with direct code in the templates.   Plugins aren&#8217;t bad and should be used as required.  Just don’t use too many.  Always keep them up to date and remove unused templates from your server.</p>
<h3>Avoid Widgets</h3>
<p>Widgets are fun.  You drag items around and they appear on your blog.  You can download new ones and re-position them at will.  They make things easy but also introduce overhead.  Widget compatible themes add function calls and widget positions and content are stored in the database which equals extra database reads.  For this reason, I never use widgets and always strongly recommend against them.  The problem isn&#8217;t the features provided by the widgets but the overhead that comes with them &#8211; all of which could easily be avoided by simply coding the feature directly in your templates.</p>
<h3>Avoid Frameworks</h3>
<p>There are some incredible theme frameworks out there.  Developers have spent a tremendous amount of time developing a codebase that runs on top of WordPress and provides a huge amount of additional functionality.  Then they can easily put together a theme that runs on top of the framework.  </p>
<p>Many of the themes are gorgeous and coding a theme on a framework, once past the learning curve, can be faster and easier because the framework already has so many features built right in.  They also usually provide a very slick administration panel which provides easy ways for a user to change the header image and set a myriad of options that control how the site works.  </p>
<p>These are very useful features but it comes at a high cost.  Frameworks add an entire layer of codebase, action hooks and database reads between your theme and WordPress.  For lower traffic sites, this overhead might not be noticeable, but high traffic sites are going to pay for the convenience the framework provides.  I always advise against using framework based themes.</p>
<h3>Use Clean Templates</h3>
<p>There are a myriad of ways to reduce function calls and database usage when coding a template.  The biggest one is to figure out when a WordPress call like bloginfo() is giving you a static result and either store the result in a variable or even hard code it into the template.  Granted, this does makes a theme less portable but this post is concerned with optimization, not portability.  </p>
<p>Eliminate widget code if you are not using widgets (which you shouldn’t be), and avoid unnecessary include statements.  Special loops that find recent or related items can bring in plenty of overhead.  If possible, eliminate them.  If not, find a way to make them faster or cache the results periodically.  I realize this section is very broad and is requires advanced php and WordPress experience.  Yet it had to be included because a clean set of templates is critical in order to serve content efficiently and quickly.</p>
<h3>Implement a Hybrid Webserver Solution</h3>
<p>Apache is a full featured webserver and does a good job processing php.  Nginx is a svelte minimalist webserver that does a really good job delivering static content.  Picture Apache as a 4WD vehicle with big tires and a V8 engine, and Nginx as a Toyota Prius.  You want to use the 4WD to drive up into the mountains, but it would be wasteful to drive it for a local shopping trip &#8211; take the Prius instead.  Using Apache to deliver simple static content like stylesheets, javascript and images is the same kind of waste because Apache&#8217;s overhead is always there, whether you are rendering a complicated page via php or delivering a plaintext stylesheet.</p>
<p>I&#8217;ve effectively employed both servers in a hybrid solution which leverages the strength of Apache as needed but utilizes Nginx for the easy stuff.  It works like this:  Nginx listens on port 80 (the standard http port) and then a set of rules helps it decide if it should deliver the request itself (js, html, css, images) or pass it on to Apache.  Apache listens on port 8080 and can quickly respond to requests for dynamic WordPress content.  </p>
<p>It is pretty normal for a single page to have between 10 and 30 static items which must also be read.  Think how happy Apache would be if the number of requests was reduced by 90%?  Granted, this only removes the easy requests, but it still dramatically reduces the overall load.  And using low footprint Nginx to deliver a stylesheet instead of Apache with all its overhead is going to improve speed and reduce server load.</p></div>
<h2>Actions that cost money</h2>
<div style='padding-left:20px;'>
<h3>Use a CDN</h3>
<p>CDN stands for content delivery network.  It is a service that can store and deliver your static content (images, stylesheets, javascript) on demand.  A good CDN delivers those items very quickly which speeds up pageloads for your site and simultaneously reduces the number of requests your server has to deal with.  There are plugins (like w3tc) which make using a CDN pretty seamless to you and to your visitors.  <em>This is a huge bang for the buck option &#8211; highly recommended.</em></p>
<h3>Dedicated server</h3>
<p>Shared hosting is great when you are starting out because it is a cheap option and usually does a good job with a low traffic WordPress site.  However, as your design becomes more complicated and your hit count rises, you may notice really slow loadtimes and the admin interface may become almost unusable.  You are also potentially at the mercy of the other sites on the same server.  If one of them is behaving badly or gets a boatload of traffic, your performance can suffer through no fault of your own.  A dedicated server is an expensive option (comparatively) but makes you less dependent on the actions of other users on a shared service.  However, It is <strong>not a magic bullet</strong> – having a dedicated server does not mean you can ignore all other optimization options described here.</p>
<h3>Dedicated database server</h3>
<p>A dedicated server is great, but it still has to act as a webserver and also as a database server.  By adding a second dedicated server to handle the database side of things, your webserver is now single purpose and can focus on generating and delivering pages as quickly as possible.  For high traffic sites using WordPress, this is a great (but even more expensive) way to go.</p>
<h3>Multiple Load-Balanced Servers</h3>
<p>Supersites have to use this simply to handle all the requests.  I have worked with WordPress sites which handle huge amounts of traffic but are still extremely fast.  They employ almost every option above and also employ multiple load-balanced servers.  If you ever get that big, you will have to spend the big bucks and go this route also.</p></div>
<p>I hope at least some of that is new information and helps you make sure your site delivers your content as fast as possible.  I know some people will disagree with some of this and I fully expect hate mail from some who either develop or employ Frameworks, which is fine.  The point of this post was not to please everyone, but simply to take a critical look at anything that adds overhead to WordPress and ways to reduce it.  </p>
]]></content:encoded>
			<wfw:commentRss>http://blogrescue.com/2011/12/my-take-on-wordpress-optimization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stealth Hacking</title>
		<link>http://blogrescue.com/2011/12/stealth-hacking/</link>
		<comments>http://blogrescue.com/2011/12/stealth-hacking/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 04:49:46 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blogrescue.com/?p=321</guid>
		<description><![CDATA[Could your WordPress install be Hacked without you knowing about it? Similar to the Pharma-Hack, there is a new stealth hack which affects compromised WordPress sites and most people have no idea their site is infected. The reason for the ignorance is that the hack doesn&#8217;t affect any content on the infected site &#8211; except [...]]]></description>
			<content:encoded><![CDATA[<p>Could your WordPress install be Hacked without you knowing about it?</p>
<p>Similar to the <a href='http://www.pearsonified.com/2010/04/wordpress-pharma-hack.php'>Pharma-Hack</a>, there is a new stealth hack which affects compromised WordPress sites and most people have no idea their site is infected.  The reason for the ignorance is that the hack doesn&#8217;t affect any content on the infected site &#8211; except for pages delivered to googlebot.  For those pages, it injects &#8220;Free live streaming porn &#8211; &#8221; in front of page titles which gives nasty search results for innocuous content.</p>
<p>Take a look at these search results: <a href='http://www.google.com/search?q=%22free+live+streaming+porn%22' target='_blank'>google search for: &#8220;Free live streaming porn&#8221;</a>. (Link is SFW).  </p>
<p>About 11 million hits and if you read the summary content, most are blogs or pages from a WordPress installs that have search results that are injected with a bogus title and keywords. (Either the hack does not target Bing and Yahoo, or hacked pages end up futher down in the result set for those search engines, at least that is what I saw on those sites with the same search.)</p>
<p>So how do you know if your blog is one of these hacked sites?  Do the same google search with the site tag:</p>
<blockquote><p>
&#8220;Free live streaming porn&#8221; site:blogrescue.com
</p></blockquote>
<p>Mine comes up clean, but it is probably a good idea to check yours.  If you are infected, then you need to deal with the issue right away, and then comes the agonizing wait for googlebot to recrawl these pages and replace the damaged pages with the real version.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogrescue.com/2011/12/stealth-hacking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress Admin Bar Issue in Version 3.3</title>
		<link>http://blogrescue.com/2011/12/wordpress-admin-bar-issue-in-version-3-3/</link>
		<comments>http://blogrescue.com/2011/12/wordpress-admin-bar-issue-in-version-3-3/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 01:36:20 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blogrescue.com/?p=318</guid>
		<description><![CDATA[If you have upgraded to WordPress 3.3 and the admin bar is not where it is supposed to be, it would be a good idea to check your function.php for the following code: wp_deregister_script('admin-bar'); wp_deregister_style('admin-bar'); remove_action('wp_footer','wp_admin_bar_render',1000); The above code is pretty common in 3.1 themes to permanently remove the bar from the theme. However, in [...]]]></description>
			<content:encoded><![CDATA[<p>If you have upgraded to WordPress 3.3 and the admin bar is not where it is supposed to be, it would be a good idea to check your function.php for the following code:</p>
<pre>
wp_deregister_script('admin-bar');
wp_deregister_style('admin-bar');
remove_action('wp_footer','wp_admin_bar_render',1000);
</pre>
<p>The above code is pretty common in 3.1 themes to permanently remove the bar from the theme.  However, in 3.3, the bar still appears in wp-admin but it isn&#8217;t pretty.  If you have a blank space for the bar but it isn&#8217;t visible, try scrolling to the bottom and see if you have unstyled bar items on the bottom left of the page.  Then check your functions.php for the code above and comment it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogrescue.com/2011/12/wordpress-admin-bar-issue-in-version-3-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Time to Upgrade Again</title>
		<link>http://blogrescue.com/2011/12/time-to-upgrade-again/</link>
		<comments>http://blogrescue.com/2011/12/time-to-upgrade-again/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 23:43:16 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blogrescue.com/?p=302</guid>
		<description><![CDATA[Because WordPress 3.3 (aka &#8220;Sonny&#8221;) has been released. More Info here.]]></description>
			<content:encoded><![CDATA[<p>Because WordPress 3.3 (aka &#8220;Sonny&#8221;) has been released.</p>
<p><a href='http://wordpress.org/news/2011/12/sonny/'>More Info here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogrescue.com/2011/12/time-to-upgrade-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SASS for WordPress</title>
		<link>http://blogrescue.com/2011/12/sass-for-wordpress/</link>
		<comments>http://blogrescue.com/2011/12/sass-for-wordpress/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 00:04:14 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[haml]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[sass]]></category>

		<guid isPermaLink="false">http://blogrescue.com/?p=276</guid>
		<description><![CDATA[SASS is a programmable approach to stylesheets which really adds some cool features. (Full reference is available here.) It can make a stylesheet easier to read, easier to update and also adds some powerful features like functions, variables and imports. It is pretty easy to add to Ruby and Drupal, but usually requires Compass installed [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://sass-lang.com/'>SASS</a> is a programmable approach to stylesheets which really adds some cool features. (Full reference is available <a href='http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html'>here</a>.)  It can make a stylesheet easier to read, easier to update and also adds some powerful features like functions, variables and imports.  It is pretty easy to add to Ruby and Drupal, but usually requires <a href='http://compass-style.org/'>Compass</a> installed on the server.</p>
<p>I&#8217;d glanced at SASS before, but today someone brought it back to my attention and my first thought was &#8220;How can I use that in WordPress?&#8221;  A few hours of coding and testing later, I&#8217;ve got a pretty nifty plugin solution for anyone who wants/needs SASS features.  </p>
<p>It is probably less than perfect since it uses a fairly dated <a href='http://code.google.com/p/phamlp/'>php port</a> of HAML/SASS.  Any limitations of that code will reflect in the plugin since it just serves as a wrapper.  However, it does not require Compass installed on the server and is really easy to install and start using.  </p>
<p>Here is the plugin:</p>
<p><a href='http://blogrescue.com/downloads/wordpress_sass.3.2.0.zip'>
<div class='button rounded'>WordPress SASS Plugin<br /><span class='version'>Version 3.2.0</span></div>
<p></a></p>
<p>Here is how to make it work:</p>
<p>1. Install the plugin.<br />
2. Copy style.css to style.scss in your theme.<br />
3. Add the following code to your theme&#8217;s functions.php.</p>
<pre>
// Enables SASS to CSS automatic generation
function generate_css() {
  if(function_exists('wpsass_define_stylesheet'))
    wpsass_define_stylesheet("style.scss", "style.css");
}
add_action( 'after_setup_theme', 'generate_css' );
</pre>
<p>4. Make style.css writable (0775).<br />
5. When editing the stylesheet, make all updates in style.scss only.<br />
6. The plugin detects when style.scss has been updated, and rebuilds style.css from it.</p>
<p>If you try it, let me know how it goes and what you think of SASS.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogrescue.com/2011/12/sass-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress Vulnerability</title>
		<link>http://blogrescue.com/2011/11/wordpress-vulnerability/</link>
		<comments>http://blogrescue.com/2011/11/wordpress-vulnerability/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 18:33:22 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blogrescue.com/?p=230</guid>
		<description><![CDATA[This is pretty old news, but I keep finding myself delousing hacked wordpress installs so it definitely bears repeating! TimThumb is a pretty cool script that provides on-the-fly cropping and resizing of images.  It is cool enough that it has been included in a large number of WordPress plugins and Themes (both free and paid). [...]]]></description>
			<content:encoded><![CDATA[<p>This is pretty old news, but I keep finding myself <em>delousing</em> hacked wordpress installs so it definitely bears repeating!</p>
<p>TimThumb is a pretty cool script that provides on-the-fly cropping and resizing of images.  It is cool enough that it has been included in a large number of WordPress plugins and Themes (both free and paid).  Unfortunately, there is a pretty significant <a href="http://codegarage.com/blog/2011/08/how-to-clean-up-the-timthumb-security-vulnerability/">exploit </a>which allows hackers to upload or modify php scripts on your system.  That, in turn, gives them access to do just about anything they want.</p>
<p>Millions of wordpress installs are at risk from this issue&#8230;which raises the big question: how do I know if I have a problem?  Fortunately, Peter over at <a href="http://codegarage.com/">Code Garage</a> made it <a href="http://codegarage.com/blog/2011/09/wordpress-timthumb-vulnerability-scanner-plugin/">easy</a> - there is now a <a href="http://wordpress.org/extend/plugins/timthumb-vulnerability-scanner/">plugin</a> which scans your install and tells you if you are vulnerable or not.</p>
<p>I highly recommend that all WordPress blogs take this simple action right away &#8211; installing and running the plugin is considerably easier than recovering from a hacked install.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogrescue.com/2011/11/wordpress-vulnerability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Import Revisited</title>
		<link>http://blogrescue.com/2011/06/wordpress-import-revisited/</link>
		<comments>http://blogrescue.com/2011/06/wordpress-import-revisited/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 21:52:54 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blogrescue.com/?p=198</guid>
		<description><![CDATA[After managing my way through two very large conversions into WordPress (one from Blogger and one from MovableType), I now know that my last post on the wordpress import plugin was a bit premature. If you really want to import a .wxr file into WordPress that is larger than 2MB, here are the changes you [...]]]></description>
			<content:encoded><![CDATA[<p>After managing my way through two very large conversions into WordPress (one from Blogger and one from MovableType), I now know that my last post on the wordpress import plugin was a bit premature.  If you really want to import a .wxr file into WordPress that is larger than 2MB, here are the changes you need to make to the wordpress importer:</p>
<p>First, find the following code (should be somewhere around line 64):</p>
<blockquote><pre><code>var $featured_images = array();</code></pre>
</blockquote>
<p>Just below that line, add the following:</p>
<blockquote><pre><code>var $import_filename = '../export.wxr';</code></pre>
</blockquote>
<p>Please note that export.wxr should be changed to the name of your import file.  Also note that the when the file is uploaded, it needs to be in the wordpress root (where wp_config.php and the wp_admin folder are located).</p>
<p>Second, there is a switch statement in the function named <b>dispatch</b>.  Find it and make the following changes to it:</p>
<blockquote><pro><code>switch ( $step ) {<br />
&nbsp;&nbsp;case 0:<br />
&nbsp;&nbsp;&nbsp;&nbsp;$this->greet();<br />
&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;case 1:<br />
&nbsp;&nbsp;&nbsp;&nbsp;// check_admin_referer( 'import-upload' );<br />
&nbsp;&nbsp;&nbsp;&nbsp;if ( $this->handle_upload() )<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this->import_options();<br />
&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;case 2:<br />
&nbsp;&nbsp;&nbsp;&nbsp;// check_admin_referer( 'import-wordpress' );<br />
&nbsp;&nbsp;&nbsp;&nbsp;// $this->fetch_attachments = ( ! empty( $_POST['fetch_attachments'] ) &#038;&#038; $this->allow_fetch_attachments() );<br />
&nbsp;&nbsp;&nbsp;&nbsp;// $this->id = (int) $_POST['import_id'];<br />
&nbsp;&nbsp;&nbsp;&nbsp;// $file = get_attached_file( $this->id );<br />
&nbsp;&nbsp;&nbsp;&nbsp;// set_time_limit(0);<br />
&nbsp;&nbsp;&nbsp;&nbsp;// $this->import( $file );</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;set_time_limit(0);<br />
&nbsp;&nbsp;&nbsp;&nbsp;$this->import($this->import_filename);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
}</code></pre>
</blockquote>
<p>What we've done here is commented out the file import code and added code to call the import routine with our own filename that was defined earlier.</p>
<p>One more change:  Find the function <b>handle_upload()</b> and update the first few lines so it looks like this:</p>
<blockquote><p><code>function handle_upload() {<br />
&nbsp;&nbsp;// $file = wp_import_handle_upload();<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;// if ( isset( $file['error'] ) ) {<br />
&nbsp;&nbsp;// &nbsp;&nbsp;echo '&lt;p&gt;&lt;strong&gt;' . __( 'Sorry, there has been an error.', 'wordpress-importer' ) . '&lt;/strong&gt;&lt;br /&gt;';<br />
&nbsp;&nbsp;// &nbsp;&nbsp;echo esc_html( $file['error'] ) . '&lt;/p&gt;';<br />
&nbsp;&nbsp;// &nbsp;&nbsp;return false;<br />
&nbsp;&nbsp;// }<br />
&nbsp;&nbsp;//<br />
&nbsp;&nbsp;// $this->id = (int) $file['id'];<br />
&nbsp;&nbsp;// $import_data = $this->parse( $file['file'] );</p>
<p>&nbsp;&nbsp;$import_data = $this->parse($this->import_filename);<br />
</code></p></blockquote>
<p>Just like above, we are commenting out all the file upload code and then forcing the parse action on our uploaded file.</p>
<p>Once your plugin has been updated, do the following:<br />
1. Upload your import file into the wordpress root directory (again, where wp-config.php resides)<br />
2. Run Tools -> Import -> WordPress.</p>
<p>At the first screen, do not select an upload file.  Just click the <b>Upload File and Import</b> button and things will proceed from there.  If your import file is extremely large, you may need to adjust some server settings (memory limits, timeouts, etc.) in order to process the entire file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogrescue.com/2011/06/wordpress-import-revisited/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Import &#8211; Dealing with Large Files</title>
		<link>http://blogrescue.com/2011/04/wordpress-import-dealing-with-large-files/</link>
		<comments>http://blogrescue.com/2011/04/wordpress-import-dealing-with-large-files/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 04:49:01 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blogrescue.com/?p=183</guid>
		<description><![CDATA[One of my current projects is migrating a very large blog from Blogger to WordPress.  There is an importer plugin for WordPress but I (and obviously many others as well, judging from the support forums) could never get it to work. Instead I have a blogger export in xml format, converted it to a wordpress [...]]]></description>
			<content:encoded><![CDATA[<p>One of my current projects is migrating a very large blog from Blogger to WordPress.  There is an importer plugin for WordPress but I (and obviously many others as well, judging from the support forums) could never get it to work.</p>
<p>Instead I have a blogger export in xml format, converted it to a wordpress wxr file using the &lt;a href=&#8217;http://code.google.com/p/google-blog-converters-appengine/&#8217;&gt;Google Blog Converter&lt;/a&gt;.  The resulting file is 48MB (about 3500 posts).  The WordPress wxr importer uses the standard wordpress upload system and limits the import file to 2MB.  This <strong>is</strong> a problem.</p>
<p>But it can be done&#8230;</p>
<p>After installing the wordpress uploader plugin (I&#8217;m using WordPress 3.1 by the way&#8230;), change to the plugin directory and edit <em>wordpress-uploader.php</em>.  Find the following method in the file:</p>
<blockquote>
<pre><code>/**
* Registered callback function for the WordPress Importer
*
* Manages the three separate stages of the WXR import process
*/
function dispatch() {</code></pre>
</blockquote>
<p>Further down in this method is a switch statement with three cases (0, 1, and 2).  Add the following code after the line containing: <code>break;</code> (at the end of the case 2 section):</p>
<blockquote><p><code> </code></p>
<pre><code>case 99:
&nbsp;&nbsp;&nbsp;$file = '../import.wxr';
&nbsp;&nbsp;&nbsp;set_time_limit(0);
&nbsp;&nbsp;&nbsp;$this-&gt;import( $file );
&nbsp;&nbsp;&nbsp;break;</code></pre>
</blockquote>
<p>Save these changes and upload your import file to your wordpress root directory.  Make sure the filename is set to <i>import.wxr</i>.  Then navigate in the wordpress admin interface to Tools -&gt; Imports -&gt; WordPress.  The url should read something like: </p>
<blockquote><p><code>http://domain.com/wp-admin/admin.php?import=wordpress</code></p></blockquote>
<p>Add <code>&amp;step=99</code> to the end of this url and load the new page.  The full url should read:</p>
<blockquote><p><code>http://domain.com/wp-admin/admin.php?import=wordpress&amp;step=99</code></p></blockquote>
<p> It may take a long time for the page to load but that is normal as it is importing your content.  Do not interrupt the process.</p>
<p>As with all free advice here, no guarantees and no promises to assist in the comments.  But this q&amp;d (quick &amp; dirty) hack saved me hours of breaking the import file into very tiny pieces.  Hope it helps someone else out there.</p>
<p><strong>UPDATE:</strong></p>
<p>This was the first step and got me started, but it bypasses some of the import step that is pretty important (linking authors for instance).  Maybe someday if I ever have time (and someone wants it), I will post the rest of the changes I made to the original plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogrescue.com/2011/04/wordpress-import-dealing-with-large-files/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>iPhone App Released</title>
		<link>http://blogrescue.com/2011/03/iphone-app-released/</link>
		<comments>http://blogrescue.com/2011/03/iphone-app-released/#comments</comments>
		<pubDate>Sat, 05 Mar 2011 19:07:48 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Phone Apps]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blogrescue.com/?p=174</guid>
		<description><![CDATA[Ok, haven&#8217;t blogged in forever, mostly because I&#8217;ve been tied up learning iOS and then coding the iphone version of my Android App. Here is the app: Michelle Malkin. If you want to give it a spin. A good portion of my &#8216;free&#8217; time for the last year has been spent on developing these two [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, haven&#8217;t blogged in forever, mostly because I&#8217;ve been tied up learning iOS and then coding the iphone version of my <a href='http://blogrescue.com/2010/07/first-android-app-on-the-marketplace/'>Android App</a>.</p>
<p>Here is the app: <a href='http://itunes.apple.com/us/app/michellemalkin-com/id421697100?mt=8'>Michelle Malkin</a>.  If you want to give it a spin.  A good portion of my &#8216;free&#8217; time for the last year has been spent on developing these two apps.  The nice thing is that now I an past the learning curve and have experience serving wordpress content for both platforms.  Now to see if I can sell some other bloggers on apps for their own sites!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogrescue.com/2011/03/iphone-app-released/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

