WP Security Audit Log

Its very important to ensure the security of your wordpress site, You have to take some basic security precautions for your site.WP Security Audit log will Identify WordPress security issues before they become a security problem. It Keeps  a security audit log of what is happening under the hood of your WordPress blog or website or your WordPress Multisite installation.

This plugin will work both on WordPress single site installations and WordPress Multisite.

 Audit Log plugin is developed by WordPress Security Consultants and Professionals WP White Security and is the only WordPress monitoring and auditing plugin that works on both WordPress single site installations and WordPress Multisite.

Download From: WordPress.org

Woocommerce – add products automatically to cart on visit

Today i am going to share one of the feature which my client asked to me, and that is to add the product automatically once the visitor viewed that product. Hope this will help someone who is having requirement like this.

* To be added on theme's functions.php or a custom plugin
// add products automatically to cart on visit
add_action( 'init', 'add_product_to_cart' );
function add_product_to_cart() {
if ( ! is_admin() ) {
global $woocommerce;
$product_id = 64;
$found = false;
//check if product already in cart
if ( sizeof( $woocommerce->cart->get_cart() ) > 0 ) {
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
$_product = $values['data'];
if ( $_product->id == $product_id )
$found = true;
// if product not found, add it
if ( ! $found )
$woocommerce->cart->add_to_cart( $product_id );
} else {
// if no products in cart, add it
$woocommerce->cart->add_to_cart( $product_id );

Create Simple Shortcode In WordPress

We may come across some situations to use the shortcodes,even if you are a beginner, you can try to create your own shortcodes with below example.

The following short code will help you to embed from various video websites like vimeo, youtube etc.

/* Video Embed */
add_shortcode('video_embed', 'embed_video'); // This then accepts the function below embed_video and allows the user to enter the shortcode in there post.
function embed_video($atts){
    $atts = shortcode_atts(
            'src'       => ' ', // This is left blank but if you want to add a video as a default, that is up to you.
            'width' => '600', // Default Width
            'height'    => '338', // Default Height
            'title' => 'There is a video in this post.' // This a great default caption to have for your RSS Feeds. That way users will know that a video is available in the post to watch.
        ), $atts);
        return '
        <embed src="'.$atts['src'].'" type="application/x-shockwave-flash" width="'.$atts['width'].'" height="'.$atts['height'].'" allowscriptaccess="always" allowfullscreen="true"></embed>

The above functions can be copied to functions.php in your wordpress theme.

To display the video, the following shortcode can be used.

[video_embed src="http://www.youtube.com/watch?v=6WC5ufuc6m0" width="680" height="360" title="Sample Video"]

.htaccess Useful tips

To disable directory Browsing :

# To Disable Directory Browsing
Options All -Indexes

Domain Redirection:

.htacces code for redirecting yourdomain.com to www.yourdomain.com

RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]

To Hide the Extension:

RewriteRule ^([^/.]+)/?$ $1.html


How to do redirection properly using .htaccess

Hey, i think redirection is more important for SEO. Here i would like to share some information related to .htaccess and this may help you.

Using .htaccess file, you can easily configure and redirect Apache Web Server file system.

We may need to set the URL Redirection from OLD one to new One. then we can use the following code in .htaccess file(which is 301 redirect).

Redirect 301 /old.html http://site.com/new.html/

by adding that code in .htaccess, you can do redirection from old url to new url as per your need.


How to disable automatic updates in wordpress

WordPress Announces the automatic updates from version 3.7 on-wards, and this is for better security.

In WordPress, there are four types of automatic background updates:

  1. Core updates
  2. Plugin updates
  3. Theme updates
  4. Translation file updates

Configuration via wp-config.php

Using wp-config.php, automatic updates can be disabled completely, and core updates can be disabled or configured based on update type.

To completely disable all types of automatic updates, core or otherwise, add the following to your wp-config.php file:


To enable automatic updates for major releases or development purposes, the place to start is with the WP_AUTO_UPDATE_CORE constant. Defining this constant one of three ways allows you to blanket-enable, or blanket-disable several types of core updates at once.

define( 'WP_AUTO_UPDATE_CORE', false );

Hope this help….!

Solving get_available_shipping_methods() method errors

The error looks something like this (the full path and line number may be different):

Fatal error: Call to undefined method WC_Shipping::get_available_shipping_methods() in .../wp-content/themes/THEME-NAME/woocommerce/checkout/review-order.php on line 14

This issue is caused by your theme, they are bundling outdated template files in their themes that have been deprecated for a while now. You should contact the theme developer to get this fixed properly. You can delete that specific file from your theme until this issue has been patched by your theme developer for a temporary fix. WooCommerce will fall back on the default template file, bundled with the plugin.

Variable products won’t add to cart – Woocommerce Upgrade Issue

I have seen that still there some theme having bundled with old files for the add to cart template being used for variable products, adding a variable product to cart fails. This should be solved by the theme developers by updating the template file.

In order to solve this woocommerce upgrade issue, the quick solution is to delete the below mentioned file from the theme directory.


This will make WooCommerce use the new bundled template file and your variable products will add to cart again. Once your theme developer updates your theme, please check if it actually works as that will overwrite this change again.