How to Remove WooCommerce Generator Tag

WooCommerce Generator Tag

WooCommerce Generator TagSometime we needed our Code to be clean without any extra meta tags generated by different WordPress Plugins we have installed on our site. Like many other plugins, WooCommerce also added it’s Generator Tag into Source Code of your website.

If you are not debugging your website than it’s good to remove this tag for above reason and one other more important reason i.e. Security purpose. Some time we finished website for a client and later you are not managing the website updates and it’s on client end.. most probably they won’t do any updates on there website leaving security hole into there website by letting people know which version they are using for particular plugin.
Like WordPress, Plugin author keep there plugins updated maintaining themself updated with new code of WordPress but if you have old version on your website there are chances someone attack your website by manipulating old plugins security holes.

Good thing about WooCommerce is that it allows different hooks and functions to over ride it’s default outputs of code, which make things lot easier if you understand what you wanted to achieve.

here is the code snippet to remove WooCommerce Generator Tag from the source code of your WordPress Website, you can add this into functions.php file:

Remove WooCommerce Generator Tag from version 2.1 and latest

function my_woocommerce_loaded_function() {
 global $woocommerce;
 remove_action( 'wp_head', array( $woocommerce, 'generator' ) );
}

add_action( 'woocommerce_init', 'my_woocommerce_loaded_function' );

Remove WooCommerce Generator Tag from previous versions

function my_woocommerce_loaded_function() {
 global $woocommerce;
 remove_action('wp_head', array($GLOBALS['woocommerce'],'generator'));
}

add_action( 'woocommerce_init', 'my_woocommerce_loaded_function' );

How To Display Custom Message To WordPress Login Page

Sometime as Site Admin we wanted our users to be notified about something important while they are about to Log In into WordPress back-end. for example, we might give them instruction to change passwords for security reason or want them to know you are super genius
WordPress allows us to display custom message to WordPress Log in Page using its filter login_message , see example below..
WordPress-Demo-Log-Inall we need to do is to open up our active theme’s function.php file into our favorite code editor (I am using beautiful code editor Brackets, you can use whatever your favorite code editor is.)  and insert following code into it. you can change welcome message as per your requirements within this code.


function bdn_login_text( $customtext ) {
 if ( empty($customtext) ){
 return "<p class='message'>Welcome to WordPress Demo site. This is Custom Text Message for Visitors.</p>";
 } else {
 return $customtext;
 }
}
add_filter( 'login_message', 'bdn_login_text' );

Save file, and open your WordPress Log in Page to see your Custom Message.

Change Autosave Interval in WordPress

If you are writing a long post, then autosave feature will save your posts regularly while you are writing them, it will make your blog database loaded, if you are a regular poster, it’s a good feature in wordpress, which let you to go back to the previous version of post if you lose power during writing or unexpectedly done changes which are not you wanted, so going back to the version which you think is the closest you are writing is good feature.

but over the days when posts getting coming to your wordpress, your database start loading with lot of posts revisions.. there are few plugins which will just clear your revisions on your will, but there is a way to control the time in which wordpress will save your post, you can adjust it according to your writing speed or on any other parameter you are feeling okay.

To change autosave interval in wordpress you need to edit wordpress core setting file i.e. wp-config.php.

add following line just before the comment “That’s all, stop editing! Happy blogging.”  in wp-config.php file.

define(‘AUTOSAVE_INTERVAL’,120);

note: time is in seconds.

how to change WordPress admin username

For security reasons, it is important. that default WordPress admin username to be changed. In the WordPress backend itself, there is no way to do this. This is easily performed in a MySQL admin program such as phpMyAdmin by following code:

UPDATE wp_users
SET user_login = 'newname'
WHERE
user_login = 'admin' ;

Please replace table prefix with your own if set to different then “wp_”.

How to Control Image Size in WordPress using CSS

It often happens that a picture is wider than the range is displayed in the Content. Especially if you have several authors who are not so experienced in WordPress.

In order to embed large images but to avoid destroying of the layout, simply add following lines of CSS in the styles.css file.

Control Image Size in WordPress using CSS

.Post area { img max-width: 400px; height: auto;}