6 Great WordPress Tricks Everyone Should Know

I love WordPress because much of its functionality is dead simple. However, I’ve found that it usually takes some tweaking and 3rd party plugins to get everything working to my taste.

1. Auto-update with SSH instead of FTP
I maintain dozens of WordPress installs for various reasons. I absolutely love that you can auto-update with one click. The default mechanism behind this behavior is FTP. That’s fine for shared hosting, but when I moved to my Linode VPS, FTP became just another daemon that would be nice to avoid for the pain of configuration, not to mention security.

WordPress is cool enough to support updating over SSH but you have to edit your config.inc.php file like so:

define('FS_METHOD', 'direct');
define('FTP_BASE', '/srv/path/to/wordpress/root/');
define('FTP_CONTENT_DIR', '/srv/path/to/wordpress/root/wp-content/');
define('FTP_PLUGIN_DIR ', '/srv/path/to/wordpress/root/wp-content/plugins/');
define('FTP_USER', 'username');
define('FTP_PASS', 'password');
define('FTP_HOST', 'example.com:22');

Learned how to do this from Karl Blessing’s helpful blog.

2. Highlight the syntax of your code snippets for virtually any language
After playing around with handful of code formatting plugins, I finally got comfortable with Syntax Highlighter ComPress. It supports an impressive list of languages and integrates nicely into the TinyMCE editor. You can stick with the visual editor and avoid HTML entirely. This is a big deal for me because I don’t want to write HTML when I’m writing content.

3. Create a static front page
Before I had written any posts for this blog, I set the home page to my list of projects.
From the WordPress Codex:

Go to AdministrationSettingsReading panel.

  1. Set ‘Front page displays:’ to ‘a static page’ and choose the first page you created above for ‘Front page.’ If your WordPress site will contain a blog section, set ‘Posts page’ to the page your created for this above. Otherwise, leave this blank.

4. Install the Google XML sitemaps plugin
From what I can tell, having a sitemap for WordPress has been a effective SEO tool. Searching for sitemap builders in the plugin directory will bring up many results. The only one you need is called Google XML Sitemaps by Arne Brachhold. Consider donating because the plugin is fully featured, but a breeze to install and deploy.

5. Eliminate spam comments forever
After letting BeatLogic.org sit dormant for several months, the comment queues were overflowing with about 5000 spam comments. There are nuanced ways to combat spam, but I prefer this three step kill-it-with-fire approach.

  1. Disable comments on future posts under Settings->Discussion->Allow people to post comments on new articles
  2. Disable comments on old posts under Posts->Select All with checkbox->Edit->Comments->Do not allow.
    Do this for every post at once by using the checkbox at the top of the Posts table and the bulk action dropdown.
  3. Delete spam comments by logging into your SQL database and running a
    DELETE FROM wp_comments WHERE comment_approved=0

Warning: These steps will completely disable commenting on your blog and delete every unapproved comment. Make sure this is right for your situation.

6. Recover from broken plugins
On a few occasions I’ve had a wordpress install die after an update because of plugin trouble. Usually the home page will fail to load at all or the posts page will die halfway through. The trick is to disable all plugins and re-enable them one by one. Run one of these on your database
SELECT * FROM wp_options WHERE option_name = 'active_plugins';
and delete the text string in the one matching row. Everything should then load normally, leaving the sleuthing up to you. Thanks to WordPress pro Jeff Star for this one.