In this article I am explaining some useful basic tricks of WordPress that can be managed via theme’s functions.php and wp-config.php file. WordPress theme functions.php file, where you can manage menus, widgets, creates and defines number of settings of your WordPress theme. Some WordPress tricks are listed below.
Disable the Admin Bar
When you logged in to the WP Admin panel WordPress puts a administration bar on top of site. I don’t like this admin bar while working on theme customization, so I disable this feature. To disable the WordPress admin bar simply insert below line in functions.php file.
add_filter('show_admin_bar', '__return_false');
Remove the WordPress Generator Meta Tag
WordPress puts a meta tag that indicates site was generated by WordPress with the version.
<meta name="generator" content="WordPress 3.5.1" />
If you don’t want to hide this information from the user, you can add following line to functions.php file to remove this meta tag.
remove_action('wp_head', 'wp_generator');
Post Revisions
In recent versions of WordPress post revision is most important feature that auto saves post just in-case if your browser crash or something else happen. It allows you to restore back to previous version of the post revision, if you don’t want the changes. But some users don’t like this feature, because if they write a long article and save it in draft it saves as a revision and these revision are not required after the article published. So there are some configurations to control number of revisions.
Auto-Save Interval
WordPress saves every post in 60 seconds by default, if you want to change this interval you can add following line in wp-config.php file.
define( 'AUTOSAVE_INTERVAL', 180 );
If you don’t like this feature and want to disable auto-save you can add following line in functions.php file.
add_action( 'admin_init', 'disable_autosave' ); function disable_autosave() { wp_deregister_script( 'autosave' ); }
If you want to limit the number of revisions per post you can add following line in wp-config.php file.
define( 'WP_POST_REVISIONS', 4);
you can use any integer you like.
If you don’t like the post revision feature, you can simply disable this by adding following line in wp-config.php file.
define( 'WP_POST_REVISIONS', false );
I hope this article will be helpful for you.