MixBag WordPress Snippets Collection – Part 4 Of 5

Programming-2

Modifying Size Of Embedded Videos

Simply paste the following snippet on your functions.php file and you will be able to modify the size of embedded videos as per your requirements.

Snippet Source/Credit: Shailan

How To Automatically Delete Trash On Daily Basis

When you delete a post or a page or a comment, it goes in a Trash instead of being removed permanently. Using the following snippet will ease you job of deletion and will tell WordPress to automatically delete the trash itself. Simply copy and paste the following lines of code in your wp-config,php file and you are done.

Note: Make sure that you do replace 1 by X to empty spam comments automatically every X days.

How To Remove WordPress Version Number

WordPress, by default, publicly display its version number in both its RSS and Atom feeds. Well, while using the snippet, you will be able to remove it. Simply paste the following snippet in your functions.php file and you will be able to remove WordPress version number.

Snippet Source/Credit: Jeff Starr

How To Execute Shortcodes Inside Custom Fields

WordPress, by default, don’t allow shortcodes to be executed inside custom fields. While, if in case, you want to do it so, then this can be done by using the following snippet below. Simply paste the snippet to the page where you wish to display the results of the shortcode. While doing this, make sure you do change your_custom_field_here to the name of your selected custom field.

Snippet Source/Credit: Snipplr

Securing Your WordPress Blog Uploads Directory

Although WordPress is a very secure system one actually thinks of BUT since there is always a room open for more improvement, using the following snippet will let you secure your WordPress blog uploads directory.

To do so, first of all, create a file named .htaccess and paste the following code in it. Once you created it, upload the same into your wp-content/uploads directory. Remember at line 5 in the snippet below; make sure to add/update all the extensions you want to make it work for you.

Snippet Source/Credit: Jeff Starr

How To Easily Get Post Content By ID

Using the following snippet will let you easily get post content by ID. All you have to do is to simply use the get_post_field() function to get the post content and you are done.

How To Embed A Page Into Another Page In Your WordPress Blog

Using the following snippet, you will be able to embed a page into another page in your WordPress blog.

Snippet Source/Credit: CSS Tricks

The Editorial Team

The Editorial Team

The Editorial Team at JustWP is a team of WordPress experts led by Karan Chopra.

You may also like...