I enjoy simplicity, in everything. Unnecessary complexity is evil. Have a look at my WordPress plugins.

20 WordPress Tweaks to improve your blog!

There are a lot of easy WordPress tweaks that you can do to up the security of your WP blog, help your SEO or change the way that your blog feels. I’ve decided to start a list of all those easy tweaks that you can do. These are all easy things which don’t require any plugin at all, just a little copy pasting. Of course there’s a lot more to add to this list, but i’ve decided to keep all the tweaks short. Some WordPress enhancements just deserve their own post. Nevertheless, I think everyone can pick a few things to do that will improve their blog.

Tweaking your wp_config.php

Let’s start out with your ‘wp-config.php’ file. You can actually tweak a lot by just defining some options in your configuration file. Doing so will reward you with increased security mainly. Let’s see what we’ve got.

1. Moving your wp-content directory.

Did you know that you could actually move your wp-content folder around? This is the directory that holds all your WordPress themes, plugins, and uploads. To do so just set WP_CONTENT_DIR and WP_CONTENT_URL to the full local path of this directory (no trailing slash), e.g.

define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content' );
define( 'WP_CONTENT_URL', 'http://example/blog/wp-content');

2. Moving your plugin directory

You can also move your plugin directory for even more security. Don’t think that doing so messes up all your plugins, 99% of the plugin developers don’t use absolute path’s to their plugin dirs. And well, they shouldn’t. So if a plugin stopped working, be grateful cause it was badly developed.

define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' );
define( 'WP_PLUGIN_URL', 'http://example/blog/wp-content/plugins');
define( 'PLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' );

3. Set your auto-save interval

You’ve probably noticed that WordPress autosaves your posts when you’re busy writing them. If you want this to happen more often or less just change the auto interval. Note that this is in seconds.

define('AUTOSAVE_INTERVAL', 160 );

4. Enable/disable Post revisions

To decrease database memory usage you may want to switch off using revisions. WordPress defaults this option to true, to turn this off just add the following the line.

define('WP_POST_REVISIONS', false );

5. Specify a number of post revisions

If you don’t want that much post revisions, but also don’t want none at all you can also specify a maximum number of post revisions.

define('WP_POST_REVISIONS', 3);

6. Install your downloaded translation.

Most local WordPress site offer .mo files that contain the translation of WordPress for your country. To use this translation put them in your /wp-content/languages/ folder and define WPLANG. You can also store the .mo files in another folder and define the language folder too.

define('WPLANG', 'de_DE');
define('LANGDIR', 'mylanguagedirectory'); //if not in the languages folder.

7. Empty your trash more often.

If you want your trash to be emptied more often just define the number of days between each empty as followed.

define('EMPTY_TRASH_DAYS', 30 );  // 30 days

8. Disable your trash

You can also choose to disable your trash completely. Note that WordPress does not ask for a confirmation when you’re deleting something permanently.

define('EMPTY_TRASH_DAYS', 0 );  // No trash at all.

9. Database repairing

In WP 2.9 WordPress added an automatic repair option for the database. You can enable this script to be used whenever this repairing is needed. Note that this happens automatically, and you don’t have to be logged in for it.

define('WP_ALLOW_REPAIR', true);

10. Multiple blogs on one database

Another fine option is to add a prefix to your database tables, so you can run multiple blogs while using just one database. To define your table prefix find the following line, and change the ‘wp_’ to your desired prefix. Do this anyway for some extra security, even if you’re not planning to use multiple blogs.

$table_prefix  = 'wp_';

Some technical SEO tweaks

11. Change your permalink structure

The most import tweak that most people suggest you to do is to change your permalinks. While I totally agree and admit that this is one of the first things I do when setting up a new blog, I don’t suggest you change it to the standard %category%/%postname%/. Instead change it to the following; for the reason why just check what WordPress has to say about this on their Permalink Page.

%post_id%/%postname%/

12. WWW. or non-WWW.

Just pick one and stick with it. Fill this in as your Site url and your blog url, at your General Settings.

Use your theme’s functions.php file.

The functions.php file of your theme is pretty powerful, all the functions declared in there can be used troughout your theme and work just like plugins do. You can easily add some filter functions to your functions.php that will change how your blog acts.

13. Change your excerpt length.

One thing you can do is change your excerpt length, like you see on a lot of blogs. Doing so is easy, just add the following lines of code to your functions.php, this for example returns a length of 75.

add_filter('excerpt_length', 'my_excerpt_length');
function my_excerpt_length($len) { return 75; }

14. Change the standard [..] to something more engaging!

Changing the [...] what cuts off your excerpts is also very easy. Let’s say you just want 3 dots?

function new_excerpt_more($length) {
	return '...';
}
add_filter('excerpt_more','new_excerpt_more');

15. Add a read more link to the end of your excerpts.

So you want a link added at the end of your excerpts? The following function will make a “» Read more about “the post title”. ” show up after every excerpt.[/code]

function new_excerpt_more($length) {
     return '&raquo Read more about "<a href="'.the_permalink().'">'.the_title().'</a>';
}
add_filter('excerpt_more','new_excerpt_more');

16. Check for HTTP-Refferer, to prevent spammers

Some spambots usually don't have their HTTP-refferers set. To block people who don't have this set add the following lines to your theme's functions.php

function check_HTTP_ref() {
    if (!isset($_SERVER['HTTP_REFERER']) || $_SERVER['HTTP_REFERER'] == “”) {
        wp_die( __('Please enable referrers in your browser!') );
    }
}
add_action('check_comment_flood', 'check_HTTP_ref');

17. Remove WP version nr.

For security reasons (especially on older WP's) you should remove the WP versions number from your source code. To do this just add the following function.

function q_remove_wp_version() {
return '';
}
add_filter('the_generator', 'q_remove_wp_version');

18. Add stuff to your feed content

You've probably seen blog feeds that had additional content below their content, or ads. You can easily accomplish this by adding this to your WordPress functions file

function q_addtorssposts($content) {
if(is_feed()){
$content .= 'Go check out Qoate.com for more awsome posts!';
}
return $content;
}
add_filter('the_excerpt_rss', 'q_addtorssposts');
add_filter('the_content', 'q_addtorssposts');

19. Disable login error messages

To make your blog just a little harder to hack you can add the following function, which will disable the error message that show up when you provide the wrong password or username. This way a hacker doesn't see when they got something right.

add_filter('login_errors',create_function('$a', "return null;"));

20. Add your own icon!

Every blog shoud have their own icon, just because visuals are way faster recognized by your visitors then just plain text. Having an icon helps your visitors to recognize your blog tab in their browser and adds a little unique identity to your blog! Upload your favicon to your WordPress folder and add the following lines to your theme's functions.php

// add a favicon to your
function my_favicon() {
echo '<link rel="shortcut Icon" type="image/x-icon"
 href="'.get_bloginfo('wpurl').'/favicon.ico" />';
}
add_action('wp_head', 'my_favicon');

That's it. These are all very easy tweaks, and they all add just a little to your blog. You know of a little tweak you'd like to see added, just let me know!

Share this post: on Twitter on Facebook

2 Responses to “20 WordPress Tweaks to improve your blog!”

  1. Thank you Danny for those great tips. They will even eliminate some simple plugins, like the one for removing the WP version.
    Instead of modifying the functions.php I would suggest that you create a Child Theme with its own functions.php and add the suggested functions to it. It will preserve your functions even if you download an update to the theme from its developer.
    I also downloaded your plugin Scroll-Triggered box. Would it be possible to have the box to display the Reply box in order to make it more likly that the reader leaves a reply?
    Lennart Johansson
    http://www.zoft80.com
    PS! You have still links pointing to your old website at http://wordpress.org/extend/plugins/qoate-scroll-triggered-box/

Leave a Reply