WordPress Tips + Things You Can Do After Installing Wordpress

The WordPress tips and few hacks mentioned below may only apply to a self-hosted installation of WordPress version 2.6 or above.

*If your WordPress blog is hosted on wordpress.com, please skip this.

Tip 0: Change the Default Image Upload Folder

The default installation of WordPress will store all your images inside wp-content/uploads folder.

image-upload-folder

You can however use a different folder or even sub-domain on your web server for saving file uploads as in the setting screen above. This offers two advantages – your image URLs become relatively shorter and second, the size of your WordPress folder will always remain small and manageable.

Also deselect the option – "Organize my uploads into month- and year-based folders."

Tip 1: Remove unnecessary code from your WordPress header.

WordPress by default adds a version number to the header of all your blog pages.

<meta name="generator" content="WordPress 2.5" />

This information may prove a goldmine for WordPress hackers as they can easily target blogs that are using the older and less secure versions of WordPress software. To completely remove the version number from WordPress header, add this line to your functions.php file in the WordPress themes folder.

<?php remove_action('wp_head', 'wp_generator'); ?> 

Tip 2: Prevent people from casually browsing your WordPress Folders

Since you definitely don’t want Peeping Toms to navigate your WordPress files and folders using the explorer view in web browsers, add the following link to your .htaccess file that exists in the main WordPress installation directory.

Options All -Indexes

Tip 3: Windows Live Writer Templates & WordPress

If you not blogging via the Windows Live Writer client, add the following line to your functions.php file.

<?php remove_action('wp_head', 'wlwmanifest_link'); ?>

The WLW-Manifest function is used by Windows Live Writer to download the styles / themes used in your WordPress blog. Windows Live Writer users who do not use the live preview feature may also turn off this function.

Tip 4: Turn off Post Revisions in WordPress 2.6

WordPress 2.6 introduced Wikipedia style document revisions where you have access to all previous version of the document making it easy to revert incase you make any mistakes.

This may be a great feature for blogs where multiple authors work on the same blog post but 99% of WordPress users don’t need it. Post revisions also increase the size of WordPress wp_posts table as each revision means an additional row.

To disable post revisions in WordPress 2.6, add this to your wp-config.php file.

define('WP_POST_REVISIONS', false);

Tip 5: Disable HTML in WordPress Comments

The comment box is WordPress is like a basic HTML editor – people can use HTML tags like <b>, <a>, <i>, etc to highlight certain words in their comment or add live links. If you like to disable HTML in WordPress comments, add this to your functions.php

add_filter( 'pre_comment_content', 'wp_specialchars' );

Tip 6: Change location of the Plugins & WordPress Themes folder

With WordPress 2.6, you can place the wp-content folder anywhere on your web server. This may come handy when you are upgrading the WordPress installation because none of your existing themes and plug-ins will get overwritten even if you replace all the WordPress files with a tar downloaded from wordpress.org.

If you decide to move the wp-content folder to another location, specify the path in the wp-config.php file:

define(’WP_CONTENT_DIR’, ‘http://www.labnol.org/assets/wp-content’);

Tip 7: XML Sitemaps – Change the Building Mode

If you using XML Sitemaps plugin in WordPress, try changing the building mode to "manual."

xml-sitemaps

When you publish (or delete) a blog post via the WordPress write panel, the entire XML sitemap is recreated from scratch and hence may increase the overall time it takes to publish a post as you’ll have to wait until the creation process is over.

Tip 8: Turn Off Image Thumbnails in WordPress (workaround)

disable-image-thumbnails When you upload an image to WordPress, it creates two additional thumbnail images in the uploads directory. I don’t know how to prevent WordPress from creating image thumbnails but there’s a workaround if you publish posts via Windows Live Writer.

Just use the FTP publishing option for images and this will automatically disable thumbnail creation because the upload happens through a different route.

Also see this tip on creating a mobile friendly WordPress blog using Google Reader. The upcoming article will be about XML-RPC support in WordPress 2.6. Stay tuned.

Find this article at: http://www.labnol.org/internet/blogging/wordpress-tips-post-installation-hacks/3931/

Tags: , , , Blogging, Internet

Reader Comments

great tips man…but why not to remove the
<meta name=”generator” content=”WordPress 2.5″ />
line from header file of your theme rather than writing the following code in the functions. file

<?php remove_action(’wp_head’, ‘wp_generator’); ?>

@Roahsn Bhattarai

Because that generator is now generated automatically by Wordpress (I think since 2.5 or so) and not by your theme.

Btw, if you wish to inhibit all auto-generators, you can write a simple function in your functions.php

/* remove all wp auto-generators */
function noGenerators() { return ”; }
add_filter(’the_generator’,'noGenerators’);

Ah.. thanks. Was looking for something like this.

@ #1

Because this way is more “portable” in case you switch themes. Though I suspect that you’d need to preserve it across WP upgrades either way…

Is there any more unnecessary codes which we can delete? I hope it woould make the blog run a bit faster!

Thanks for this tricks!

Good post. Thank you
What didi you mean by casually browsing. What is its effects?

Thanks Amit, It surely helps a lot

Great job! Could I translate it to chinese and publish to my blog ?

Brilliant Tips. I never knew that there are so many things to do after installing WordPress.

I can not afford to miss reading this blog for a single day.

Amit – You are the Best of Tech Bloggers.

Hey… thanks a ton for these tips.

Tip4 of Post Revisions is must do for all single user wordpress to keep database size in controlled state!

Great tips!
I’ll be sure to implement many of them.

Great tips. Amit can you also post information on how to promote wordpress blogs online.

Some interesting points. However some of them verge on paranoia and are really a step too far for the casual user. I’d prefer urging users to always make sure they have the latest version of WP for example, instead of removing the version number from the header.

Some good ideas to think about though

Very useful tips for anyone using WordPress.
Thanks for the tips.

Hi -

I want to move my wp-content folder, but when I make the changes, Wordpress loads nothing. Are there any requirements about where you have the new wp-content folder? I’ve also tried defining WP_CONTENT_URL in addition, but still no luck.

Ideas?

Actually, I figured it out. Almost every plugin that I have explicitly references the default wp-content directory, so it is these that are breaking Wordpress.

Great idea, but doesn’t seem to work in practice. Thanks for the other tips though.

Good point about post revisions. I will turn them off in my sites.

great tips, amit – this article will help a lot.

Once you have disabled Revisions, how can you drop the previously archived ones from the db?

I’ve tested the tips #1, 3 and 4 and they didn’t work in my Wordpress 2.6 :( What’s happening?

Great article, thanks.
I know workaround to image thumbnails:
in settings/misc.
two fields:
“Thumbnail size” and “Medium size”
just leave fields blank i.e. does not specify any sizes :) tn’s will not be created..

Nice article. I have just started blogging and recently upgraded to WP 2.6.
Is there a WP plug-in that lets us do the same thing?

Great article, those tips come in handy. Mahalo.

Hey Amit:

Great Tips! However, the version number removal does NOT work… I’ve even gone as far ahead as applying the:

remove_action(’wp_head’, ‘wp_generator’);
remove_action(’wp_head’, ‘wlwmanifest_link’);

to ALL 3 theme subfolders… Nothing! when I “re-apply” my theme and refresh my site, I still see the version #s…

Am I doing something wrong?

There are several functions.php, so maybe I’m editing the wrong ones? The ones I’ve edited are:

../wp-content/themes/classic/functions.php
../wp-content/themes/default/functions.php
../wp-content/themes/<mymoddedone>/functions.php

Any help?

KnightMare : maybe it’s comes from header.php files on your active themes directory.

#15 & #16: I got the same as Shaun when using the line in wp-config.php and moving my wp-content folder elsewhere – blank blog pages and when logged in and on the ‘design’ page (where it’s looking for available themes in the wp-content folder) I got a couple of PHP errors. I’m not using any plugins so it can’t just be that.

What am I missing? This would be so useful…

@Knightmare: I had the same problem, I allready ahd remove the template code from the header.php.

Once I wrote the remove_action(’wp_head’, ‘wp_generator’);
into the header.php itself, the code was no longer in the source.

So I don’t write it into the functions.php but the header.php, works great!

Re. Tip 6 – I’ve got this working now. Your example defines WP_CONTENT_DIR with a URL. WP_CONTENT_DIR is the directory path, there’s another new 2.6 variable for the URL – WP_CONTENT_URL.

I dropped WP_CONTENT_DIR from my wp-config.php file and set WP_CONTENT_URL instead, and this is working fine on my blog.

From what I’ve read though, this may cause problems with certain plugins that have hard-coded paths (as Shaun says at #16).

Yeah for tip #1 inserting that code caused some funky errors but deleting the line that generates the version number from the header.php file did the trick.

If it’s relevant, the blog in question is on 2.7 bleeding edge, not sure if something in that version causes the insertion to fail or perhaps it’s the them used (The Morning After).

To remove the WP version tag, you can also edit genral-template.php (includes). At about line 1207 you’ll find

function wp_generator() {
the_generator( apply_filters( ‘wp_generator_type’, ‘xhtml’ ) );
}

change that to

function wp_generator() {
the_generator( apply_filters( ‘xhtml’ ) );
}

Disabling the generation of thumbnails and/or medium sizes is also easy. In the admin, go to Settings -> Miscellanious and empty the thumbnails and/or medium sizes fields for width and height. Then Save. No thumbnails and/or medium sized images will be generated.

This line killed my NextGEN photo on side bar:

It will be great if WP can officially allow people to switch on and off of those features.

Forgot to note Amit disabled html on comment : )

I meant this wp_generatorline:

remove_action(’wp_head’, ‘wp_generator’);

I have a question that I cannot seem to find an answer for.

What I want to do is be able to pass a parameter (a flash file name) to a blog page. This blog page contains a swf player that will then play that flash file. Is this an easy thing to do? If so, I am lost would appreciate any help.

Thank you in advance.

count me in, KFChow,
I would love to have tutorials on tips and tricks merging flash apps into wordpress

The first two steps that I tend to carry out after a fresh install are invariably rewriting permalinks and installing wp-cache. Can make a world of difference.



Google Custom Search