Thursday 31 October 2013

Stop WordPress From Compressing JPEG Images

According to some blogs, WordPress automatically compress your JPEG images to 90% quality, but this information is false.

This only happens on the resized images WordPress creates. The original uploaded image is saved unaltered, as the "full" size.

Anyways, you can stop compressing of JPEG images by putting following code into your functions.php file:

add_filter('jpeg_quality', function($arg){return 100;});
add_filter( 'wp_editor_set_quality', function($arg){return 100;} );

Google: How Fast Is Our Hummingbird


15 years have past since Google Search first appeared on the stage. Back in 1998 the searching process was far from perfection:  the huge machine called computer is on, the user type in keywords into the search system and the system manages to find several websites with the required information. Now it sounds funny, but at that time it was a miracle!

The whole process and the devices have changed since 1998. It is so easy to find billions of websites with one click on a tiny device in your pocket. Search systems are powerful, quick and very convenient. You can even ask the question in a loud voice and your inquiry will be satisfied. What else can be done here? Are there possible improvements? Google proves that there is always space for making changes and striving for better result.

New search algorithm from Google has got a beautiful name of a small but smart bird – the Hummingbird. It was presented on the press-conference dedicated to the 15th anniversary of Google.   The name for the new offspring was chosen in order to emphasize the accuracy and high speed of its work. The company said that changes in the search engine had been made a month ago and covered 90% of search queries, but the notification on the transition to the new search algorithm Hummingbird was decided to give on the 15th anniversary of Google. The press conference took place in the garage, where 15 years ago Sergey Brin and Larry Page had started a glorious history of  the search giant.

Amit Singhal, the head of Google's core ranking team, says that the current updated search algorithm is perhaps the most radical since 2001, the year he began to work in the company. Last major update search engine Caffeine was aimed primarily at increasing the speed of information indexing rather than the processing of the collected information. Hummingbird handles requests not only for keywords, but also according to their meaning. Thanks to this function, the inquiries made by users can be longer and more complex.

As the nature of inquiries has changed recently, the need to improve search algorithm appears. Earlier search inquiries were made in the form of short phrases with a large number of keywords. Today a user can make up search inquiries with the help of colloquial phrases, sometimes quite long and complex. The second reason, which made ​​it necessary to use a new search algorithm is the development of voice search. The time offers new standards, gadgets and approaches for search systems, that is why now is the right time for changes.

Tamar Yehoshua, vice president of the research department, demonstrated the abilities of new search algorithm to understand the associated inquiries. She offers Google to open photos of the Eiffel Tower, and immediately afterwards, without specifying what exactly she is talking about, asks questions: "What is its height?", "When was it built?", "Show me the photos of the building process". Next she presented the way voice search Google works offering to find information about the Impressionist painters.

Unfortunately, there is no way to compare the results of search system efficiency "before" and "after" the introduction of the new search algorithm. However, Google gives a few examples. For instance, request «acid reflux prescription» (acid reflux recipe) used to offer a list of medications that may be useless for users who sought for general information on the treatment and general information about the necessity to take medicine. The new algorithm offers the article containing this exact information.

Is it possible that the new search algorithm from Google made the search system worse? Hummingbird creators are sure that is unlikely, saying that they can’t approve that search system is better now, still, there are no evidences of dissatisfaction on the part of users. As everybody knows, people complain when they notice errors but they rarely see improvements.

Time will show how fast and smart Hummingbird is. A month after its start new algorithm justifies our hopes.

Author Author - Melisa Marzett is an experienced writer, she mainly works on such topics as internet innovations, web press and social media. Her articles are also available on best college paper writing service. It is easy to contact with Melisa on Google+
Join Us On:

Tuesday 29 October 2013

Remove Author Prefix From Slug In WordPress


Earlier this month I shared an article about changing WordPress Author URL Slug. That code will change the default yoursite.com/author/name to yoursite.com/profile/name.

Now this trick will remove the author prefix from the author slug. To clarify, this snippet will help you turn: yoursite.com/author/name/ into: yoursite.com/name/.

Just add following snippet to your functions.php file:

// The first part //
add_filter('author_rewrite_rules', 'no_author_base_rewrite_rules');
function no_author_base_rewrite_rules($author_rewrite) {
    global $wpdb;
    $author_rewrite = array();
    $authors = $wpdb->get_results("SELECT user_nicename AS nicename from $wpdb->users");   
    foreach($authors as $author) {
        $author_rewrite["({$author->nicename})/page/?([0-9]+)/?$"] = 'index.php?author_name=$matches[1]&paged=$matches[2]';
        $author_rewrite["({$author->nicename})/?$"] = 'index.php?author_name=$matches[1]';
    }  
    return $author_rewrite;
}

// The second part //
add_filter('author_link', 'no_author_base', 1000, 2);
function no_author_base($link, $author_id) {
    $link_base = trailingslashit(get_option('home'));
    $link = preg_replace("|^{$link_base}author/|", '', $link);
    return $link_base . $link;
}

Props to WP-Snippet for this amazing tricks.

Detect And Redirect Android Users With .htaccess

Last night I shared a trick to redirect Android users to your Android/mobile website with a simple PHP snippet. It's time to do the same with .htaccess file. Android is the most used smart phone platform right now, and is a hot topic for developers.

Add this following code to your .htaccess file to redirect users with Android User Agent to a specific address:

RewriteCond %{HTTP_USER_AGENT} ^.*Android.*$
RewriteRule ^(.*)$ http://android.yourwebsite.com [R=301]

Monday 28 October 2013

Detect And Redirect Android Users With PHP

Here is a simple trick to redirect Android users with some simple PHP script. It's a useful snippet if you have an Android version of your website.

Add following PHP to your document to search and redirect Android user agents:

$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
if(stripos($ua,'android') !== false) { // && stripos($ua,'mobile') !== false) {
    header('Location: http://android.yourwebsite.com');
    exit();
}

More tricks like this are on their way...

Allow Contributors To Upload Images In WordPress

Are you running a WordPress website with bunch of contributors who are willing to post on your website? If yes then this article contains a great tip for you.

As I mention on previous articles, every post on your blog must contain at least one image related to the article. It's really great for SEO and other things.

This code will help us to allow users with contributor role to upload images on your WordPress site.

Add this code to your functions.php file:

if ( current_user_can('contributor') && !current_user_can('upload_files') )
     add_action('admin_init', 'allow_contributor_uploads');
    
     function allow_contributor_uploads() {
          $contributor = get_role('contributor');
          $contributor->add_cap('upload_files');
     }

Thursday 24 October 2013

How To Disable Smart/Curly Quotes In WordPress

There are lot of word processor programs which itself converts all yours simple quotes to curly quotes (aka s mart quotes). It looks like small figures six and nine raised above the baseline (like 6...9 and 66...99).

It's a huge problem if you're writing codes in your posts as WordPress automatically converts all quote symbols to smart quotes. So if anyone is copying a snippet from your blog post would have problems with running to code in their own text file.

You can easily disable this feature with a small snippet. Just add following snippet to your functions.php file:

<?php
remove_filter('the_content', 'wptexturize');
remove_filter('comment_text', 'wptexturize');
remove_filter('the_excerpt', 'wptexturize');
?>

That's it!

Wednesday 16 October 2013

Send Email Notifications When User Submit A Post In WordPress

Are you running a multi-author WordPress blog or a blog with guest posters with contributor role to submit the post directly from the WordPress dashboard? Then you must be looking for a way to get email notification when someone submit a post or when you publish or reject their post.

We previously shares some great scripts to get email notifications for a couple of events, but this time it's a plugin.

WP Status Notifier is all you're looking for!

The plugin sends an email to the admin (or selected user) when ever some one submit a post for review and when you publish or reject their post, author will get instant emails. After installing the plugin, you can access it’s setting under Settings > Post Status Change Notifications.

WP Status Notifier's interface is not much complicated, as you can check it below:


It's a great plugin, but if you want some advance options, then you can also use Post Status Notifier Lite.

Personal Note: First of all, Eid-Mubharakh to all my Muslim readers. I'm going out on a small seven day trip tomorrow, so don't expect me to post any articles here on BWidgets. Thanks for all your support!

Sunday 13 October 2013

Prevent Directory Browsing With .htaccess

I recently shared several articles about .htaccess file, and as you may know by now, it's a great file if you're working on the security of your site. Today we'll disable the directory browsing in our website with some editing in .htaccess file.

You know how you can change a few characters in a URL and continue browsing the website. Sometimes, it could be very dangerous for our website, so it's time to prevent directory browsing.

Add following snippet to your .htaccess file:

# directory browsing
Options All -Indexes

Save the file, and that's it!

How To Remove Footer Credits From Jetpack Mobile Theme In WordPress


Jetpack is a great plugin for WordPress to connect your blog to WordPress.com. It also gives us dozens of crappy great plugins for our blog, such as mobile module, social share, wp.me short links, and more.

Jetpack's Mobile module is great plugin to create a mobile version of your website for mobile users, but it comes with a footer credit: Proudly powered by WordPress.

Giving WordPress their credit for their hard work is not bad, but if you're interested then you can easily remove the Jetpack.

In your file manager, edit footer.php file which can be found inside public_html/wp-content/plugins/jetpack/modules/minileven/theme/pub/minileven

Just remove this code from line #27:

<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'jetpack' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'minileven' , 'jetpack'); ?>" rel="generator"><?php printf( __( 'Proudly powered by %s', 'minileven' , 'jetpack'), 'WordPress' ); ?></a>

That's it.

Friday 11 October 2013

Protect Your wp-config.php File With .htaccess

As a webmaster, it's our duty to take care of our website. And security is our #1 priority when it comes to take care of a blog. As we know, there are millions of security issues with WordPress, which can be solved with some simple things, such as security plugins, configuring our .htaccess file, etc.

Today we'll secure our wp-config.php file with some basic .htaccess editing. Add following code to your .htaccess file:

<files wp-config.php>
order allow,deny
deny from all
</files>

This code should be placed in an .htaccess file located in the directory that contains your wp-config.php file.

Thursday 10 October 2013

Optimize And Repair WordPress Database

In WordPress 2.9, WordPress gave us a new automatic database repair feature. This feature enables you to repair and optimize your database. You should use this feature time to time to take care of your website's home.

You can use this feature even when you're not logged in to your website. This is because its main intent is to repair a corrupted database, Users can often not login to their WordPress when the database is corrupt.

Just add following snippet to your wp-config.php file to activate this feature:

define( 'WP_ALLOW_REPAIR', true );

Once activated, you can see the settings on this page: http://www.yoursite.com/wp-admin/maint/repair.php

Once you are done repairing and optimizing your database, make sure to remove this from your wp-config.php.

Send Email Notifications When User Role Changes In WordPress

Yesterday I shared a code which sends an email to the user when the user updates their profile. Today I have something similar, but a bit different. This code sends an email the user when the user's role has changed.

It's a great way to let a member know about the role changes that you'll make. It's also a great trick if you're running a WordPress site with bbPress forum or multiple wirters & contributors.

Just add following to your functions.php:

function user_role_update( $user_id, $new_role ) {
        $site_url = get_bloginfo('wpurl');
        $user_info = get_userdata( $user_id );
        $to = $user_info->user_email;
        $subject = "Role changed: ".$site_url."";
        $message = "Hello " .$user_info->display_name . " your role has changed on ".$site_url.", congratulations you are now an " . $new_role;
        wp_mail($to, $subject, $message);
}
add_action( 'set_user_role', 'user_role_update', 10, 2);

That's it.

Wednesday 9 October 2013

Increase Maximum Upload File Size Limit In WordPress

Sometimes, you need to upload a large file to your site. If you run a WordPress site with audio podcasts, videos, and .zip files, then you may need to increase WordPress' default 32mb limit.

There are lot of ways around the internet to increase your WordPress max upload file size, but most of them are not much hardy. But a little snippet by Word Impressed can solve your problem. You can easily increase or decrease your maximum upload file size limit.

Create a php.ini file (using notepad document) and upload it into your /wp-admin/ folder and add following snippet into the file:

memory_limit = 32M
upload_max_filesize = 32M
post_max_size = 32M
file_uploads = On

You can change 32m in the above code to whatever max file size you want.

Send Email Notifications When User Profile Updates In WordPress

Adding this snippet to your functions.php file will send an email to the user when the user updates their profile. It's really great way to provide more security to your users. It's also a great trick if you're running a WordPress site with BuddyPress or bbPress. It makes your website look more advance, and keeps your user secure from hackers.

Just add following to your functions.php:

function user_profile_update( $user_id ) {
        $site_url = get_bloginfo('wpurl');
        $user_info = get_userdata( $user_id );
        $to = $user_info->user_email;
        $subject = "Profile Updated: ".$site_url."";
        $message = "Hello " .$user_info->display_name . "\nYour profile has been updated!\n\nThank you for visiting\n ".$site_url."";
        wp_mail( $to, $subject, $message);
}
add_action( 'profile_update', 'user_profile_update', 10, 2);

Tuesday 8 October 2013

Restrict Access To WordPress Media Uploads

Ever wanted to restrict access WordPress media upload mime/format? Yes, that's why you guys are reading this post. You can perform this trick with directories such as /uploads/, /upgrade/, and /backups/. All you need a .htaccess file for the directory.

Create an .htaccess file for your /uploads/ directory (or use existing file if present). Add following code to the .htaccess file:

# restrict access to uploads directory
<Files ~ ".*\..*">
    Order Allow,Deny
    Deny from all
</Files>
<FilesMatch "\.(jpg|jpeg|jpe|gif|png|tif|tiff)$">
    Order Deny,Allow
    Allow from all
</FilesMatch>

The above code denies access to all files but only to the specified types of mime in the 6th line. You can also add more file types to the code such as .zip, .mp3, .mov, or anything.

You can also use same technique in other directories such as /upgrade/, /backup/, and more. Just create an .htaccess file in the directory and add the above code.

Add QR Code For Posts And Pages In WordPress

QR Code (Quick Response Code) is a great way to promote your content, and is very easy for users to use them. They can visit a webpage without even typing the entire web address. Just scan the QR Code and that's it.

The QR code system was invented in 1994 by Toyota's subsidiary, Denso Wave. Its purpose was to track vehicles during manufacture; it was designed to allow high-speed component scanning.[

Would you like to add a QR Code to your posts and pages in WordPress? It's easy just add the following snippet to your single.php file of your WordPress theme in the location you wish to display the QR.

<img src="http://api.qrserver.com/v1/create-qr-code/?size=100x100&data=<?php the_permalink(); ?>" alt="QR:  <?php the_title(); ?>"/>

To adjust the size of the QR Code just change the following within the src size=100×100.

Monday 7 October 2013

How To Hide Post View And Post Preview Buttons From WordPress Post Editor

Ever wanted to remove "preview post" & "view post" option from the WordPress' post editor? Here is the solution how to do this. Just add following snippet to your theme's functions.php file and don't forget to update the post type array in the following code:

function posttype_admin_css() {
    global $post_type;
    $post_types = array(
                        /* set post types */
                        'post_type_name',
                        'post',
                        'page',
                  );
    if(in_array($post_type, $post_types))
    echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
}
add_action( 'admin_head-post-new.php', 'posttype_admin_css' );
add_action( 'admin_head-post.php', 'posttype_admin_css' );

How To Remove URL Field From WordPress Comment Form

For some WordPress sites, such as themes, review, and all, you may want to remove Website URL field from the WordPress' comment form. Removing the field could be used for product reviews or if they created a support tickets theme that does not require a url field.

It's not much hard to remove/unset the website url from the comment form. Just add following snippet to your functions.php file and it's done:

add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields){
    if(isset($fields['url']))
       unset($fields['url']);
       return $fields;
}

Change Post Color By Status In WordPress Admin Panel

It's a great trick if you manage a WordPress site with multiple writers/contributors.It's a great trick if you manage a WordPress site with multiple writers/contributors.

Adding this snippet to your theme's functions.php file will change the background colors of the post / page within the admin based on the current status. Draft, Pending, Published, Future, Private.

add_action('admin_footer','posts_status_color');
function posts_status_color(){
?>
<style>
.status-draft{background: #FCE3F2 !important;}
.status-pending{background: #87C5D6 !important;}
.status-publish{/* no background keep wp alternating colors */}
.status-future{background: #C6EBF5 !important;}
.status-private{background:#F2D46F;}
</style>
<?php
}

How To Login To WordPress Using Your Username Or Email Address

By default, WordPress only allows us to login to WordPress powered sites only with our username. But most of us prefer to enter our email address to login because remembering your email is more simple than usernames.

C. Bavota from bavotasan.com found a great way to allow your users to use either their username or email address to log into WordPress without any plugin. Just add following code to your functions.php file:

function login_with_email_address($username) {
    $user = get_user_by_email($username);
    if(!empty($user->user_login))
        $username = $user->user_login;
    return $username;
}
add_action('wp_authenticate','login_with_email_address');

Kevin Chard improved this trick by adding a snippet to it, which will change the text on the login page from “username” to “username / email.” Add following snippet to your functions.php just below the first code:

function change_username_wps_text($text){
       if(in_array($GLOBALS['pagenow'], array('wp-login.php'))){
         if ($text == 'Username'){$text = 'Username / Email';}
            }
                return $text;
         }
add_filter( 'gettext', 'change_username_wps_text' );

Sunday 6 October 2013

How To Change WordPress Author URL Slug


In WordPress, an author's profile is by default accessible by using the yoursite.com/author/name. But it's really easy to change the default author url slug/base. All be just need is a simple snippet.

Kevin Chard found a great code to change the default yoursite.com/author/name to yoursite.com/profile/name. Just add following snippet to your functions.php file:

add_action('init', 'cng_author_base');
function cng_author_base() {
    global $wp_rewrite;
    $author_slug = 'profile'; // change slug name
    $wp_rewrite->author_base = $author_slug;
}

Replace profile on line 4 by any slug you want.

Saturday 5 October 2013

Add Short URL Below Posts In WordPress Without Plugins


Previously I shared a post on this blog about adding a Short Link Widget Below Posts In Blogger, which is a great tutorial for Blogger admins. But I never shared anything like that for WordPress blogs. There are a lot of plugins to add this short link widget below your posts, but we're going to do this without any crappy plugin.

Plus, instead of going with one short link service, you can choose between two short links services. Both services are well known, and easy to use. These two short links services are tr.im and TinyURL.

Add Short URL Below Posts In WordPress:

Add one of the following two codes to your functions.php file:

For tr.im:

function getTrimUrl($url) { $tinyurl = file_get_contents("http://api.tr.im/api/trim_simple?url=".$url); return $tinyurl; }

For TinyURL:

function getTinyUrl($url) { $tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url); return $tinyurl; }

After adding one of the above codes to your functions.php file, add following code in your single.php file, within the loop:

<?php $turl = getTinyUrl(get_permalink($post->ID)); echo 'Tiny Url for this post: <a href="'.$turl.'">'.$turl.'</a>' ?>

Above code is for a hyperlink style short link. You can also add a text box style widget with the following code:

<?php $turl = getTinyUrl(get_permalink($post->ID)); echo 'Tiny Url for this post: <input readonly="true" type="text" value="'.$turl.'"/>' ?>

Save your files, and That's IT!

Friday 4 October 2013

5 Professions For Being A Good Blogger


Before moving to very specific nuances of blogging every new person in this field of Internet acting should consider certain basic things. We are talking about that skills which are greatly required for a successful blogging career. These five professions are truly advised to master for a proficient blogger.

Profession #1 A Writer:

The ability to compose a text is the most important skil for any blogger. Even if you have a photo blog, you still have to write a title and subheadings in a correct way.

Advice: There is no need to know how to write compositions on a certain topic. to know how to write advertising texts is a more important skill!

How to become a skillful writer? There is only one possible answer! You simply need to write. Yes, it will be extremely difficult at the beginning but in time you will learn how to express thoughts and feeling “on the paper.” Classic book on how to write advertising texts can be rather helpful for a new writer. For example, it will help you with an advice on how to pick headings for articles. You can also read heading of teaser advertisings to see the way genius copywriters work.  

Profession #2 A Proofreader:

Of course, you need to write without any sort of mistakes. Sometimes misprints happen with everyone, still if you are the author of a misprint it’s you who will feel embarrassed for it! It’s of vital importance not to make mistakes. 

How to become a good proofreader? The only way out here is to read without stopping. Reading classic literature works helps a lot. Why should you choose classic literature for reading? Anyone will agree that literature of the past is reach with beautiful expressions and good grammar. At the same time not every novel by modern writer is of the same literature quality as classic work.  At the moment we themselves are working on our writing quality.

Profession #3 Marketing Specialist:

To be more specific you need to become a professional Internet marketer. It’s highly recommended to have at least basic knowledge on SEO and SMM. You can use another ways of blog advertising, like writing the website on the pavements, why not? However if you choose more traditional ways of website promotion you’d better get to know more about SEO and SMM.

Profession #4 A Programmer

To make a blog using Blog hosting services doesn’t require specific skills except of browsing. In case you have a desire to create your own blog you will have to learn how to use HTML and PHP as both of them are to be useful rather frequently.  

Profession #5 You Choose:

If you are not going to write posts on such topics as “I woke up. Today is a nice weather” you need to decide on a topic of your blog. Obviously, you have to be a professional in everything concerning the topic you choose. In other words another profession is to be mastered!

Author Author - Paul Smith works at fastcustomwritinghelp.com. He likes different innovations and if you have something new and interesting to share with him, you are welcome to the site, where he is currently working. Paul can be contacted via Google+
Join Us On: Facebook Twitter

How To Change WordPress From Name And Email Address

In many actions, such as registration, password request, plugins and more, WordPress sends email to your users and readers. The default sender name is "WordPress" and the default sender email address is wordpress@yoursite.com.

If you're working on a client site, then I guess he wouldn't like WordPress' default sender name and address. However, it's extremely easy to change the default values to your custom ones. Most of us tries to look for the settings in WordPress' wp-mail.php file, but it's not there.

There settings are written in WordPress' pluggable.php file (wp-includes / pluggable.php). Find following code in line #317- #337 of your pluggable.php file:

// From email and name
// If we don't have a name from the input headers
if ( !isset( $from_name ) )
    $from_name = 'WordPress';

/* If we don't have an email from the input headers default to wordpress@$sitename
 * Some hosts will block outgoing mail from this address if it doesn't exist but
 * there's no easy alternative. Defaulting to admin_email might appear to be another
 * option but some hosts may refuse to relay mail from an unknown domain. See
 * http://trac.wordpress.org/ticket/5007.
 */

if ( !isset( $from_email ) ) {
    // Get the site domain and get rid of www.
    $sitename = strtolower( $_SERVER['SERVER_NAME'] );
    if ( substr( $sitename, 0, 4 ) == 'www.' ) {
        $sitename = substr( $sitename, 4 );
    }

    $from_email = 'wordpress@' . $sitename;
}

First red colored WordPress in above php code is your "sender name", while second red colored wordpress is the username of your email address. Just change there values with your custom ones and save the file.

Thursday 3 October 2013

How To Disable HTML In WordPress Comments



I really hate spammers. They make me sick with their spam comments with all the bold text and hyperlinks. I know that I'm not the only one with this crappy problem, since spammers are everywhere these days. Some of them should write a book about "The life of a Spammer."

You can easily disable HTML in WordPress Comments.So if someone uses the strong code, it will not bold the text etc. It's really important for a WordPresser to disable HTML comments to prevent spammers from commenting with HTML formatted comments.

Just add following code in your functions.php file:

// This will occur when the comment is posted
function plc_comment_post( $incoming_comment ) {

// convert everything in a comment to display literally
$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);

// the one exception is single quotes, which cannot be #039; because WordPress marks it as spam
$incoming_comment['comment_content'] = str_replace( "'", '&apos;', $incoming_comment['comment_content'] );

return( $incoming_comment );
}

// This will occur before a comment is displayed
function plc_comment_display( $comment_to_display ) {

// Put the single quotes back in
$comment_to_display = str_replace( '&apos;', "'", $comment_to_display );

return $comment_to_display;


That's IT!

Wednesday 2 October 2013

Prevent Image Hotlinking With .htaccess

Image courtesy of markinns.com
Ever wonder how someone stealing your images, directly taking the URL and display on their own website can effect your bandwidths? This is what we call image hotlinking. With every single view of our images on their site cost us bandwidths. Because it's called directly from our server.

Not sure about you, but I paid for this bandwidths (not for this site). Just like almost everything, there is a way to stop thieves  from stealing our bandwidths without our permission. For those who are wondering, this tutorial is also for WordPressers.

Visit your FTP/File Manager and add following to your .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain2.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjentSbUVx-fuFCCSHSi_6OL0g8IjaYt5K94H5s5v8jCEd4THGRVviaGxcMc5LOVsmvIpC0AuKe1NK4yNMW6lax31b3K6hhQZM2TBblWoGtSQ_i9jK-e4SvIAw0NuU3Vo5KkO0y2n0rPZ4/s1600/Hotlinking.gif [NC,R,L]

By default all sites are blocked from hotlinking. Only those specified by you are allowed to do so. Don't forget to replace yourdomain.com in above code with your website's URL. You can add as many URLs as you want.

Also the link https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjentSbUVx-fuFCCSHSi_6OL0g8IjaYt5K94H5s5v8jCEd4THGRVviaGxcMc5LOVsmvIpC0AuKe1NK4yNMW6lax31b3K6hhQZM2TBblWoGtSQ_i9jK-e4SvIAw0NuU3Vo5KkO0y2n0rPZ4/s1600/Hotlinking.gif is to a image you’ve set, and whenever image hotlinking is detected, this image will show up. You can change it to your favorite hotlinking message or anything you want. Just make sure where this image is not hotlink protected.

Tuesday 1 October 2013

Hide Dashboard Login Errors In WordPress

In this tutorial, I'm going to show how you can easily hide login errors in WordPress. It's a great way to protect from WordPress from hackers. Whenever you login with the correct username but with the wrong password, a message appears saying "Error: Incorrect Password." WordPress has now given a clue to hacker that the username entered is in the system, and that they simply need to crack its password.

Similarly, an "Error: Invalid username" also appears when you enter an unavailable username. It's better for you to prevent hacking by hiding this error message. In order to keep this from happening, you need to add this code to your functions.php file:

add_filter('login_errors', create_function('$a', "return null;"));

This filter code will remove error message from the login page. The error box will still appear, but without any text.

How To Automatically Empty Trash In WordPress

The Trash feature was introduced in WordPress 2.7, and since then, if you click "Trash" for any item, it will be sent to the trash. It works similar to the Recycling Bin feature on Windows. By default, the content you trash remains there for 30 days before being permanently deleted. However, you can also delete items from the Trash at any time.

You can also modify the 30 day period with some simple codes. Just add this line to wp-config.php and you’re done:

define('EMPTY_TRASH_DAYS', 5 ); // Empty trash every 5 days

Popular Posts

 
Powered by Blogger.