Enabling Auto Updates on WordPress

If you’re hitting problems with having WordPress update itself (i.e. you’re seeing this error: “To perform the requested action, connection information is required.” ), chances are you need tofix file permissions and/or change the owner of them (likely from root).

Please feel free to cry in the comments below about this not being a secure solution, but it works.  In any case, if you’re using Ubuntu, you’ll need to make sure your permissions are right.  Once you’ve done this, change the owner of your public_html directory (and its children) by going to its parent directory and running the following command:

 chown -R www-data: public_html/

This should do it.  If you’re not using Ubuntu you might not have ‘www-data’ .. it might be something like ‘httpd’ instead.  Additionally, if your WordPress installation isn’t in the public_html directory, you’ll need to change the command accordingly.

WordPress MU (3.0+) and Thesis Theme

I’m running a WordPress MU (3.0+) installation for a cluster of websites and the Thesis theme works great out of the box.  Unfortunately, you need to hack Thesis up a little if you want the sites to have unique styles.  After searching around for a little, I stumbled on Kristarella’s awesome WPMU + Thesis tutorial.  Exactly what I was looking for.  It only involves changing a few lines of code in the functions.php file (found in your Thesis theme home directory) and allows you to then customize the style for each of your WordPress blogs.  I highly recommend you check out her tutorial and other excellent Thesis how-tos.

There were two changes I needed to make to Kristarella’s code because

  1. I didn’t want to use blog names (I used blog domain*) for the subdirectories, and
  2. I’m using Thesis 1.8 which has some slightly different syntax compared to version 1.7 and below.

So here’s the 3 things I changed in /wp-content/themes/thesis_18/functions.php (which varies only slightly from her guide):

Change this line:

define('THESIS_CUSTOM', STYLESHEETPATH . '/custom');

by tacking on a variable (we’ll define $blog later) so that it looks like this:

define('THESIS_CUSTOM', STYLESHEETPATH . '/custom' . $blog);

Next, find this line:

define('THESIS_CUSTOM_FOLDER', get_bloginfo('stylesheet_directory') . '/custom'); #wp

and add $blog to the end here as well:

define('THESIS_CUSTOM_FOLDER', get_bloginfo('stylesheet_directory') . '/custom' . $blog); #wp

Finally, define $blog at the top of the file (N.B. do this at the very top of functions.php, right below the intro comments) like this:

$blog = "/" . str_replace("/", "", substr(get_bloginfo('url'),7));

[Basically, what I'm doing here is removing the 'http://' as well as any trailing slashes.  Then I'm adding a leading '/' so that it plays nicely when it gets concatenated with the other two strings above].

Save that file, and create sub-directories beneath /wp-content/themes/thesis_18/custom for each of your domains that you’re running (e.g. /wp-content/themes/thesis_18/custom/example.com , /wp-content/themes/thesis_18/custom/examplepart2.com).  Another note on this, is that depending on what you put in Site URL under Settings > General in the WordPress admin, you may need to include a “www.” in front of your domains.

Copy over everything from the custom directory into each of these new subdirectories, and before you go, don’t forget to chmod each of these like you do each time you do a fresh Thesis installation!  Set the cache directory to 775 and layout.css to 666.  And don’t blame me if you kill your sites.

*Only do this if you are mapping domains to unique blogs.