Usefull wordpress code snippets, hacks and tips

Today i have shared the most Usefull wordpress code snippets, hacks and tips. You can add these code snippets in your functions.php. As a WordPress developer i use very often the same snippets to avoid losing time when creating a new plugin. And today is great day just because i’m going to share some of them with you.

Display Custom Image Sizes in Admin Media Uploader

Add this code in your current theme’s function.php file.

Set Featured Image automatically

Use this code in function.php. Folow the below steps :

1) Select all posts
2) Get first attached images of the posts using get_children() function
3) Use the set_post_thumbnail() function to set the featured image for the posts.

Include the HTML code in widget

Copy and paste this code in function.php and then add html code in your widget.

Empty trash automatically

If you want to empty the trash automatically,then use this code in your wp-config.php.

Post thumbnail in RSS Feed

Add favicon image
Add this code in your function.php file.

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Article Tags: ,