How to increase maximum upload and PHP Memory limit in wordpress

WordPress has a modest limit for uploading images, videos, and other files. It is a similar story for your PHP memory limit. PHP memory limit helps you run plugins and scripts. If you run a website full of content sometime this could be a big problem when php limits exhausted. You may receive “Fatal error: Allowed memory size of 12345678 bytes exhausted” error.

In this article, we will show you how to increase the maximum file upload size in wordPress and increase php memory limit.

Theme Functions File:

There are cases where we have seen that just by adding the following code in the theme function file, you can increase the upload size in wordpress:

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
@ini_set( 'WP_MEMORY_LIMIT', '96M' );

PHP.ini File:
In case of shared host you will not see php.ini file. Create php.ini file and add following code. Upload it in the root folder of the website

upload_max_filesize = 100M
post_max_size = 200M
memory_limit = 300M
file_uploads = On
max_execution_time = 180

htaccess File:
You have another option for increasing uploading size and increasing memory limit through htaccess file. Add following code in your htaccess file and upload root folder of the website.

php_value upload_max_filesize 64M
php_value post_max_size 200M
php_value memory_limit 300M
php_value max_execution_time 180
php_value max_input_time 180

wp-config.php File:
Try to editing wp-config file of the wordpress add the following to the very top of the file and save the file.

define( 'upload_max_size' , '64M' );
define( 'post_max_size', '64M');
define( 'max_execution_time', '300' );
define( 'WP_MEMORY_LIMIT', '96M' );

Add google reCaptacha to contact form 7

Hi friends, Google has an improved, user-friendly Captcha system. In Which it asked for checked a checkbox  for confirming “I’m not robot”. In WordPress, Contact Form 7 is the most popular plugin for creating contact form. Latest version of Contact Form 7 provide best way for antispam protection.

In this tutorial, I’m going show you how to integrate reCaptcha to Contact Form 7 in your WordPress Website.

Step 1. Install the Contact Form 7 plugin

  • Login to your WordPress site.
  • Go to Plugins > Add new and search for “Contact Form 7”.
  • Click “Install Now” and activate the plugin.

Step 2. Create reCaptcha public and secret keys


Step 3. Integrate reCaptcha with Contact Form 7

  • Go to the admin menu Contact > Integration.
  • Find reCAPTCHA panel and click Configure Keys.
  • Copy the site key and secret key into the fields and save them.

Step 4. Embed the reCaptcha shortcode into contact form

  • Go to Contact > Contact forms > Your form.
  • Paste below shortcode into form box to render the reCaptcha field.

End Result


Difference between MySQL and MySQLi

Basically there is no major difference between Mysql and Mysqli. Mysqli is nothing but an improved extension of Mysql.

MySQLi: – The i stands for Improved. The MySQLi extension is designed to work with MySQL version 4.1 or newer. MySQLi introduced with PHP 5.0 and MySQLi takes advantage of the newer features of MySQL 5.

Features :

  • Support for Prepared Statements
  • Object-oriented interface
  • Support for Transactions
  • Support for Multiple Statements
  • Enhanced debugging capabilities
  • Embedded server support

Connectivity in our project:
To create a connection just instantiating a new instance of MySQLi and using a username with a password connecting to the database, as follow:

$db = new mysqli('servername', 'username', 'password', 'databasename');

if($db->connect_errno > 0){
die('Unable to connect to database [' . $db->connect_error . ']');

Where $db is object for connection mysqli queries. Some various query examples are:

Select Query:

$sql = "SELECT * FROM `tablename` order by id DESC";
$result = $db->mysqli_query($sql);
while($row = $result->mysqli_fetch_array())
echo $row['name'];

Delete Query

$sql="delete from tablename where eID='$eID'";

Another Way of writing mysqli query
You can write mysql query without object pointing. See below

Select Query:

$sql = "SELECT * FROM `tablename` order by id DESC";
$result = mysqli_query($db,$sql);
while($row = mysqli_fetch_array($result,MYSQLI_ASSOC))
echo $row['name'];

Delete Query

$sql="delete from tablename where eID='$eID'";

Use of databse object inside member function of a class
I am creating a function for deleting rows. You can use $db object inside a member function by defining as global.

See below example:

function deleteBlock($eID)
 global $db;
 $sql="delete from tablename where eID='$eID'";

Use same as other queries of mysql.

Creating Custom Database Tables in WordPress

I was working on a project where I need to create a database table for my WordPress plugin. Generally we use mysql_query($sqlquery) for executing query in our PHP project. But in case of wordpress it’s bit different. WordPress provide different method for it.
Suppose I am using following query:


In above query I am creating a table named “Emp” with “Empid”,”Name”,”Email”,”Phone” fields.
Now we want some PHP method for creating table in database. See below:


require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );


dbDelta ( string|array $queries = '', bool $execute = true )

dbDelta is a wordpress function which Modifies the database based on specified SQL statements. It is used for creating new tables and updating existing tables to a new structure.

For using database prefix and charset you need to add some changes in your mysql query.

For Table prefix

 global $wpdb;
 $table_name = $wpdb->prefix . 'EMP';

For Charset

global $wpdb;
$charset_collate = $wpdb->get_charset_collate();

Now final query is

 global $wpdb;
 $table_name = $wpdb->prefix . 'EMP';
 $charset_collate = $wpdb->get_charset_collate();

 $field_sql="CREATE TABLE $table_name (Empid BIGINT(20) NOT NULL AUTO_INCREMENT, Name VARCHAR(255) NOT NULL,Email VARCHAR(255) NOT NULL,Phone VARCHAR(255) NOT NULL, PRIMARY KEY  (Empid) ) $charset_collate;";

require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );

How to create a html block in java-script variable

JavaScript is a client-side and dynamic scripting language. JavaScript allows you to build interactivity into static HTML pages. It makes pages more dynamic and interactive. Some time you need to use a large block of HTML code into JavaScript variable.

How you can create it ? First of all create HTML block you want display and assigned to a java script variable whichever wrapping in single quotes. You need a backslash at the end for string that span multiple lines and some quotes to encapsulate it overall, like this:

var html='<table class="form-table">
<tr valign="top">
<th scope="row">Field Name</th>
<input type="text" autofocus="autofocus" class="regular-text required" id="formtitle" name="formtitle" />
<span id="formtitleerr" class="err"></span>
<tr valign="top">
<th scope="row">Field Type</th>
<select id="fieldtype">
<option value="Text">Text</option>
<option value="Textarea">Textarea</option>
<option value="RadioBox">RadioBox</option>
<option value="CheckBox">CheckBox</option>
<option value="Number">Number</option>
<option value="Email">Email</option>
<span id="formtitleerr" class="err"></span>

Here is a handy tool for creating java script HTML block easily.
Click Here
It automatically creates a list of html tags, keeping the indentation.

Calculate size of databases from information schema

I was working on a project where i need to work with database, suddenly a query raise in my mind , that is database size… yes How to calculate databases size with a single query. So I get to know and sharing this to you also

Mysql Query

SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM   information_schema.tables GROUP  BY table_schema

Copy above query and paste in Sql tab of local mysql software like Xampp or Wampp. This will results with two columns named “DB Name” and “DB Size in MB”.



Url Encoder/decoder

Some time as a developer you need to encode or decode url for your purpose.

See example of encoded url:

Now you want to check what is the argument in above url. Now you need to decode it. click on below link. This is a online tool for encoding or decoding any type of url.

Click here

Paste encoded url in textbox and click on decode button. It will replace decoded url in text area.


See the example of decoded url

You can encode or decode any type of url here.

Difference between HTML and HTML5

Main Difference:

HyperText Markup Language (HTML) is the primary markup language for web pages. HTML5 is the version of HTML. There are lots of differences that are given in HTML5. The main difference between HTML and HTML5 is that video and audio are not part of HTML while these both are integral parts of HTML5 specifications.



HyperText Markup Language or simply HTML is the markup language used by web developers to create web [ages. It is written in the format of HTML elements containing tags bracketed in angle brackets like ‘<html>’. These tags use in pairs like <h1> and </h2>, although there are some empty elements as well and that is the requirement, like <img>. Web browsers can read HTML files and render them into visible or audible web page. Web browsers don’t display HTML tags and scripts, but use them to interpret the content of the page. HTML describes the structure of a website semantically along with cues for presentation, making it a markup language, instead of a programming language. HTML elements form the structure blocks of all websites. It allows images and objects to be embedded and can be used to create interactive forms.


HTML5 is the fifth version of HTML and is a core technology markup language of internet that is used for structuring and presenting the content for WWW. It is the latest, final and complete version of HTML standard of the W3C (World Wide Web Consortium). It is the successor of HTML4 that was standardized in 1997. The aim of HTML5 is to improve the language by support of latest multimedia while keeping it user friendly and easily readable by humans and consistently understood by computers and devices such as web browsers parsers, etc. HTML5 is intended to subsume not only HTML4, but also XHTML 1 and DOM Level 2 HTML. HTML5 is a response to the fact that the HTML and XHTML in common use on the WWW are mixture of features launched by multiple specifications, along with those launched by software products such as web browsers, those established by common practice.


Following are the basic differences between HTML and HTML5.

  • Audio and video were not part of previous HTML version specifications, however, both are the integral part of HTML5 specifications.
  • Vector graphics is also an integral part of HTML5 such as SVG and canvas while vector graphics is possible in HTML with the help of various technologies such as VML, Silverlight, Flash, etc.
  • In HTML, browser cache can be used as temporary storage. In case of HTML5, application cache, web SQL database, and web storage is used.
  • HTML doesn’t allows JavaScript to run in web browser, it runs in same thread as browser interface. HTML5 allows JavaScript to run in background that is possible because of JS Web worker API in HTML5.
  • HTML works smoothly with all old browsers while most of the modern web browsers have started supporting HTML5 specifications. These browsers include: Firefox, Mozilla, Chrome, Opera, Safari, etc.


Loan Period and Loan Interest Calculator

Loan Period and Loan Interest Calculator is a free WordPress Plugin for calculating loan EMI with monthly breakup and calculating loan interest. Most important thing this WordPress plugin is created by our team.

Short Code

Use [LoanPeriodCalculator] for calculation loan period calculation with monthly breakup [InterestCalculator]
is used for calculation for interest of loan from particular duration.


Loan Period Calculator Form

EMI Chart

Loan Interest Calculator Form


Interest Calculation


Download Now