WordPress Import Folder Permissions

In the course of migrating this site over to WordPress, I remembered an old, abandoned music-focus blog I had been hosting on WordPress.com. I figured that I might as well consolidate all of those posts onto this site as well.

The first step was to export the old posts from WordPress; that’s straightforward. There’s a built-in export function administration page, hiding under Tools. I chose to export all of the site content.

Once I had that archive stored locally, the next step was to import the content onto this site. The Import function is also under the Tools menu, and it will prompt you to install the WordPress Importer plugin. I completed the installation and activated the plugin.

Almost immediately, I hit an error message:

Is its parent directory writable by the server?

Some searching led me to the conclusion that the /wp-content/uploads/ folder had to be made world-writable, though I don’t fully understand why:

  1. First, I verified the current folder permissions:

    cd /var/www/jeffvautin.com/wp-content/
    ls -l
    

    The permissions were 755.

  2. Then I changed the permissions to world-writable:

    sudo chmod 777 /var/www/jeffvautin.com/wp-content/uploads/
    
  3. At this point I could import the old site.

  4. I changed the permissions back to where they had been:

    sudo chmod 755 /var/www/jeffvautin.com/wp-content/uploads/
    

After importing the content, I wanted to add it to my local Markdown file archive — in case I needed to modify it or move it anywhere else. To do this, I used Dr. Drang’s WP-MD scripts that I had previously set up. On my local machine, I first moved into the directory with the scripts:

cd /Users/jeffvautin/Dropbox/Application\ Support/BBEdit/Packages/WP-MD.bbpackage/Contents/Resources

Then I used this command to get a list of the post IDs, as a text file in BBEdit:

./recent-posts 40 | BBEdit

And finally, I imported the posts individually into BBEdit:

./get-post <post_ID> | BBEdit

Now they’re both on this site and a part of my local archive, which is a big improvement over the old arrangement, where they only lived on WordPress.com. The content isn’t as bad as I feared it was; you can see these old posts here.