Today I would like to share with you 10 very useful WordPress code snippets. The can be used to enhance website security, performance or functionality. They are very easy to use, all to do is just paste in your WordPress theme functions.php file.
You can use them on regular WordPress installation, but remember to make a backup first, because if something is missed (like closing tag) your site can be broken. Also if you are using frameworks like Genesis you'll have to check documentation if snippet is compatible with it.
What is the best about code snippets? Sometimes you can do something without a plugin, what is better for performance and server load.
This snippet is good, if you're frustrated that admin bar is overlaying your site design. Move it to the page bottom and stay calm.
This snippet is good when you want to display only excerpt of author biographical info instead of full one.
This awesome snippet is very helpful if your site is bombed with spam comments. A very time saving code.
A very nice snippet that will enhance user experience and also increase page views of your website. Good if you have a lot of traffic on specific pages and want users to browse other posts.
Nice code to remove worthless for SEO short words from posts and pages URLs.
If you're getting a lot of spam comments this snippet will prevent from linking to other sites just by removing the URL field in comments form. Also is good when you don't want to display links to comment author website.
Another great snippet that will allow you to put PHP code in WordPress text widget without a need to install plugin that will handle it. Just great!
Wonderful for enhancing security. Crawlers will not recognize your WordPress version.
Superb code to display different ads sizes after post content and without a need to use widgets for it! You can also modify this function to increase the number of ads sizes. Also remember that you'll have to add a little of css styling to display it properly.
Another cool snippet to make your site more attractive and a must if you're using MailChimp with RSS to email newsletter option.