increase upload file size limit in wordpress

Many people want to upload big size media in wordpress. Now with current version you can upload 10 mb file in wordpress.
If you want to increase upload file size limit in wordpress then you should make some changes in your wordpress code. We briefly explained same in article.

increase upload file size limit in wordpress

First option you need to open your functions.php file and put following code in that file.
Note: Here with this code you can upload the upto 50 mb file to your wordpress website.

ini_set('upload_max_size','50M');
ini_set('post_max_size','50M');
ini_set('max_execution_time,'300');

Open your wp-settings.php file which you can find in your root directory. Put following code in that file.

if ( !defined('WP_MEMORY_LIMIT') )
 define('WP_MEMORY_LIMIT', '500M');

Add this code following code in your .htaccess file. This file you can find in your root directory.

php_value upload_max_filesize 50M
php_value post_max_size 50M
php_value max_execution_time 300
php_value max_input_time 300
increase upload file size limit in wordpress
increase upload file size limit in wordpress

Above method is used by many web developers for increasing the file upload limit on server for PHP language.

how to disable wordpress post revisions

disable wordpress post revisions and increase wordpress performance. For improving the WordPress website or blog performance you need use following method.

WordPress saves the post revisions after every 2 min. That takes so much mysql storage.
To save MySQL storage, some WordPress user will be happy using this method, this method is Disable WordPress Post Revision.

how to disable wordpress post revisions

Why we need disabled this featured?

It’ because WordPress created such as dummy data revision and this one make our table sized increased. And if you have limited space, this is bad idea, and of course disable Post Revision also made your WordPress running faster.

Open your wp-config.php file and put the following code in that file. If you are not wordpress developer then dont use following code. Please consult with any wordpress developer for this code.

/* disable post-revisioning nonsense */
define('WP_POST_REVISIONS', FALSE);

Prevent external requests for your WordPress blog

When you run the wordpress blog there must be many external links would be created by others. which are not good for your blog. Some sites may be only using your wordpress images by your images links.

Prevent external requests for your WordPress

For Prevent external requests for your WordPress blog you need to use simple trick. WordPress api is given this facility to prevent the external request.

To do so, open your wp-config.php file and copy paste the following code:

define('WP_HTTP_BLOCK_EXTERNAL', true);

It will block external requests from that time on. Though, some plugins need the external request to work properly. If you experience problems, you can define a whitelist by pasting the code below into wp-config.php. Don’t forget to replace my url by the one needed by the plugin.

define('WP_ACCESSIBLE_HOSTS', 'purabtech.in');

if you are still having any issue then please contact to me.

how to remove noindex nofollow from wordpress

There are many SEO wordpress plugin which insert the nofollow attribute in link. Using our code you can remove noindex nofollow from wordpress website. If you want to remove the nofollow attribute in link then just use the following code.

how to remove noindex nofollow from wordpress

Open your functions.php file from your wordpress theme folder and put following code in that file.


function remove_nofollow($string) {
$string = str_ireplace(' rel="nofollow"', '', $string);
return $string;
}
add_filter('the_content', 'remove_nofollow');

how to remove noindex nofollow from wordpress
how to remove noindex nofollow from wordpress

show pdf in wordpress blog or website

Many people want to show there pdf files in wordpress blog. PDF is really popular format for showing the document with graphics and text and design and graphs. Without loosing the quality of text and graphics if we need to show the content then PDF is really nice format.

pdf in wordpress

pdf in wordpress
pdf in wordpress

In business world for presentation purpose all people mostly use the PDF document. Some wp developers asked about showing the pdf in wordpress.

For without any issue if you want to show the PDF document then you need to just open functions.php file and put following code in that file.
Following code I written for creating the shortcode in wordpress

function pdflink($attr, $content) {
return '<a href="http://docs.google.com/viewer?url=' . $attr['href'] . '">'.$content.'</a>';
}
add_shortcode('pdf', 'pdflink');

For showing link of PDF file in article or post you need add the following lines in the article.

[pdf href=”http://yoursite.com/linktoyour/file.pdf”]View PDF[/pdf]

Note: Upload the PDF file to your wordpress and then get the path of PDF file and then put above lines in article.
Change the path as you required.
Above code will create pdf link for your pdf document in your site.

If you does not want to create PDF link in your site and you want to show the pdf doc in your site then use following code.

function pdfshow($attr, $content) {
return '<iframe src="http://docs.google.com/gview?url='.$attr['href'] .'&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>';
}
add_shortcode('pdfshow', 'pdfshow');

For showing the PDF file in article or post you need add the following lines in the article.

[pdfshow href=”http://yoursite.com/linktoyour/file.pdf”]View PDF[/pdf]

We are looking for pdf in wordpress post, wordpress pdf tutorial,  wordpress tutorial, wordpress documentation pdf, wordpress ebook pdf, wordpress book, wordpress ppt, wordpress tutorial for beginners this for wordpress. Here we can add the pdf support using my code in your wordpress sites.

how to repair wordpress database automatically

WordPress has facility to automatically repair the wordpress database. If there is an issue with wordpress database with wordpress version.

how to repair wordpress database automatically

If you upgraded the wordpress then this feature is very helpful.

wordpress API provided a facility to repair the wordpress database automatically.
We just need to put following code in your worpdress configuration file.

Open your wp-config.php file and put following code in that file. After following line you can put the code.
define(‘DB_COLLATE’, ”);


define(‘WP_ALLOW_REPAIR’, TRUE);

This functionality is very important for new or old users of wordpress who have no knowledge about wordpress codebase. If you are having issue or problem with wordpress database then just put above line in wp-config.php file.
Using this setting wordpress will automatically repair the tables with new upgraded version of wordpress.

Automatically empty wordpress Trash comments and posts

WordPress tutorial, Automatically empty wordpress Trash comments and posts. Many times manually checking the deleted comments and posts is painful.  We need to keep our wordpress database clean so wordpress will perform faster.

Automatically empty wordpress Trash comments and posts

wordpress API provided to clean the commant and post trash automatically.
We just need to put following code in your worpdress configuration file.

Open your wp-config.php file and put following code in that file. After following line you can put the code.
define(‘DB_COLLATE’, ”);


define('EMPTY_TRASH_DAYS', 30 ); //assign the number of days

Be careful about assigning the days because after 30 days your trash will be deleted from database. So you cannot restore post or comments again from wordpress trash panel.

how to display rss readers on your wordpress

you can display rss readers on your wordpress using following code. Many wordpress blogger want to show the information RSS  readers of their site.  We given code here in this article.

how to display rss readers on your wordpress

Showing the RSS feed information to your user is good for seo and smo.

Just following code in your functions.php file.


function get_rss_readers($feed_id,$interval = 7){
$today_date = date('Y-m-d', strtotime("now"));
$ago = date('Y-m-d', strtotime("-".$interval." days"));
$feed_url="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=".$feed_id."&dates=".$ago.",".$today_date;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $feed_url);
$data = curl_exec($ch);
curl_close($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];

$rss_readers = 0;
foreach($xml->feed->children() as $circ){
$rss_readers += $circ['circulation'];
}

return round($rss_readers/$interval);
}

In sidebar.php or where you want to show your rss feed reader count there you should use the following code.

$rss_readers = get_rss_readers('wordpressapi');
echo "We currently have ".$rss_readers." RSS readers";

timthumb php script for image resizing with wordpress

wordpress tutorial, timthumb php script for image resizing with wordpress. We all know what is the tumthumb script. mainly the worpdress theme developers used the tumthumb php script for resizing the images.

timthumb php script for image resizing with wordpress

But now we dont need to use the tumthumb script in wordpress theme because wordpress api is supporting the similier functionality in wordpress.

Using the wordpress hook we can specify the thumbnail size.

You can set the post image thumbnail size using wordpress hook.

Just copy paste the following code in to your functions.php file


function custom_thumbnail_size() {
return 128; // or whatever you want
}
add_filter('wp_thumbnail_max_side_length','custom_thumbnail_size');

timthumb php script for image resizing with wordpress
timthumb php script for image resizing with wordpress

How to set post first image as featured image automatically

So using or choosing the image as featured image for post is another manual work we need to do. Info about. how to set post first image as featured image. We have SQL query for this.

From wordpress 3.0 version wordpress launched the feature called featured image. Many new wordpress themes are compatible with new wordpress version. So using or choosing the image as featured image for post is another manual work we need to do.

Many old wordpress website holder or blogger is having issue with this functionality. What they want is when they create the post they haven’t set the featured image, but they would like the featured image to default to the image that has been included in the post.

Some wordpress always use the first image as featured image but old post was not updated with featured image. They need to do manual work to set the featured image. I also faced same issue.

After doing some R&D I found the solution. If you want to set the your posts first image as featured image then use my following code.

For using the code you need to open your mysql database command prompt or phpmysqladmin program and select your wordpress database and execute the following query in that.

insert into wp_postmeta (meta_value, meta_key, post_id) select DISTINCT(ID), post_type , post_parent from wp_psts where post_type= 'attachment' and post_parent !=0 and post_status='inherit';<br /><br />update wp_postmeta set meta_key = '_thumbnail_id' where meta_key='attachment'

Using above sql query you will be able to set the featured image to your old and new post from post content. If you are having any issues with using this sql then write to me.

How to set post first image as featured image automatically
How to set post first image as featured image automatically