24 Best WordPress Tricks & Hacks To Learn Them Now

Ankit Singh (Dev)
3 years ago / Updated - April 30, 2016
24 Best WordPress Tricks & Hacks To Learn Them Now

The word Trick is very popular in blogging industry so why not do some tricks and hacks with our blogging platform currently using. Now in today’s time web is the most important platform to learn/create/share so why to stay back, that’s why we found and made some WordPress tricks & hacks that not really blow your mind but at-least give you a little unknown shortcut way to do WordPress blogging smartly. The original resource wordpress.org gives almost all types of solutions but they were down for tricks & hacks. Can you ever think how peoples think these types of things? Suppose you are a web developer and you don’t know about WordPress CMS so tell me it is possible that the developer can trick WordPress cms in just a minute? Yes ! Actually if you know about source codes of a program you can do anything with them and a little creative thinking lives in your mind can invent thousand’s of tricks same as listed below.

Before using below tricks/hacks make sure if any trick is of source code editing so use FTP client and edit source code through notepad++ because if you mistakenly do something your changes have been reverted using an UNDO function in your computer.

Custom page template

Some Page templates already come with WordPress but you can make more or unlimited templates. With page template you can make a custom page and write your own custom php/html/css codes. Mostly people use page templates for front end log-in/registration page, web application, tools and more.

→ Read the instructions for page templates

Auto 301 Redirect all of your 404 error pages to index

404 pages are really  hell, but if you think that your visitors also feels like hell with 404, so it’s a good chance to make your visitors’ experience better by redirecting all of your 404 links to the main index (homepage). There is also a benefit is the webmaster tools fix all crawl errors automatically if any error link generates.

→ Use any one plugin from All 404 redirect to homepage or 404 to 301.

Remove wordpress logo from admin bar

wp-logo-removed

In the admin bar WordPress logo is not an image or cs’s background property that’s why it’s a little tough to change this icon but now it’s possible. To remove the icon you need add the below code in your (/wp-content/themes/mytheme/functions.php) file.

→ See how to remove wordpress logo from admin bar

Disable wordpress core auto update

As your WordPress auto update to the new version automatically and it also good for WordPress security, but many people use so many plugins and sometime some plugins not work correctly with the new version of WordPress that’s why it’s good to update WordPress manually after checking all change log. Just add the below code in your wp-config.php file :

define( 'WP_AUTO_UPDATE_CORE', false );

Put Log-in form to any page/place

If you want to show log-in form in sidebar/header/footer or any place, Just add the below form code where you want to show form and change domain name from code :

<form name="loginform" action="http://example.com/wp-login.php" method="post">
<input type="text" name="log" id="user_login" placeholder="Email or Username" value="" required>
<input type="password" name="pwd" id="user_pass" placeholder="Password" value="" required>
<button type="submit" >LOG IN</button>
<input type="hidden" name="redirect_to" value="/wp-admin/">
</form>

Customize lo-gin page in your way

This trick helps you to customize your log-in page with WordPress logo. There are some plugins also available to customize but you can do this without plugin also.

→ See Customize log-in page of WordPress

Password protect /wp-admin/ Directory

authentication-required

This is a security trick you can use in the WordPress platform. Actually, this is not a big trick, but for WordPress users its very useful way to protect your wp-admin directory so the registered users only access front end.

→ Grab the password protected directory tip from WordPress Security

Display random posts from specific tags or category

As you have seen our Sidebar the news mixed and print random posts as it is you echo random posts from a specific category/tags. This trick is really useful for news and blogging sites.

→ Copy code of Random posts from specific category/tags

Separate Stylesheet for mobile users

You can also use separate mobile themes, but according to me, you don’t need to waste time in coding your mobile theme you just separate your stylesheet for mobile platform users and add below conditional code in (/wp-content/themes/mytheme/header.php). Don’t forget to change the stylesheet url from below code.

<?php if ( wp_is_mobile() ) {
echo '<link href="http://example.com/wp-content/themes/mytheme/mobile.css" rel="stylesheet" type="text/css" />';
} else {
echo '<link href="http://example.com/wp-content/themes/mytheme/style.css" rel="stylesheet" type="text/css" />';
} ?>

Time ago format

time-days-ago

Human readable format is very popular on social networking sites. It’s not important that you only use this format only in social or news site even you can use this format in any type of site like Blogging/Business/Portfolio etc.

→ See with the examples Function Reference/human time diff

Remove link from all images

If you didn’t want to link your media images to the image page you can easily add code from below resource link and next time when you upload any image in post it not contain hyperlinks.

→ Learn how to automatically remove default image links

Author of post more than one

If your posts are written by multiple authors and want to mention all authors in a post just install the co-authors Plus plugin. You can also add new guest author with this plugin.

→ Download the Co-Authors Plus Plugin

Add Whatsapp sharing button

whatsapp-button

Now with wordpress social share buttons you can add whatsapp share icon that helps visitors to directly share/send your article to our whatsapp contacts. Currently whatsapp only works on mobile platform so use Mobile conditional function to show only for mobile users.

→ Generate your WhatsApp sharing button

Integrate WordPress with your Website

If you are running a Non-Wordpress site so you can simply integrate your WordPress site to Non without losing nothing. Make sure integration not works for Multisite users.

→ Learn the process of WordPress integration with your site

Recent comments widget

Not every blog use this widget, but according to me its useful. Recent comments is the best way to tell new visitors what others telling about your article or the comments are positive or negative.

→ Download the Better recent comments plugin or Retrieve a list of comments or Disqus recent comments widget

Custom post type plugin

This is the most essential plugin that makes your blog publishing more easy. The default posts type is “post” and with this plugin you can make post types like Movies, Deals, Products and more.

→ Install Custom post Type UI plugin

Add your own Custom fields

With this trick you can easily add more fields along posts/author/pages/taxonomies and echo field’s value to any type of page. Don’t waste your time in adding fields without plugin just download plugin from below link.

→  Download Advanced Custom Fields and Learn how to use ACF plugin

Customize theme information

vintaytime-theme

Theme Developer doesn’t recommend users to change theme information, but if you little change theme functions/design in your way then its legal. You can change Theme name/Description/Author/Version from Theme stylesheet.

Just edit your  (/wp-content/themes/mytheme/style.css) file and from head change comments line which contain information.

Auto backup site to google drive/dropbox

If you are not happy with your wordpress hosting control panel backup wizard and want to backup your blog automatically to your Drive or Dropbox account, You just simply install the plugin and configure your account.

→ Download UpdraftPlus Backup and Restoration plugin

Add extension in permalink

This is the best and easiest trick among WordPress users. You can add any extension like .html, .php, .aspx, .cfm. Note that only use extension that true don’t use fake extension like .myname, .android because it not good for WordPress SEO.

  • Go to your Dashboard > Settings > Permalinks
  • Choose custom structure and add write your extension end of the structure

extension-wp-permalink

Disable Admin bar for Subscribers

I know many of you want Log-in/Registration/Profile to front end that’s why its compulsory to first hide admin bar which appear when any type of user sign in. To do this simply add the below code in your ( /wp-content/themes/mytheme/functions.php ) file :

add_action('set_current_user', 'cc_hide_admin_bar');
function cc_hide_admin_bar() {
if (!current_user_can('edit_posts')) {
show_admin_bar(false);
}
}

→ Or use Admin bar disabler plugin

Create your own short-code

The shortcut is a code that returns the value of a large code. It works same as Shorten link that change a large ugly url into a shorten memorable url link.

→ Create custom shortcode or use Custom content shotcode plugin

Hide sidebar on Home Page

If you want to make a static index page and didn’t want to show sidebar you can easily do this without using any plugin. You can also Show/hide the sidebar on any type of page using Conditional Tags. Copy below code in your ( /wp-content/themes/mytheme/index.php) :

<?php if (!is_front_page()) {
get_sidebar();
} ?>

Auto add Copyright Watermark over images of your Blog

image-watermark-wp-plugin

Safe your images and less your photoshop work with this trick. Download & install the Image watermark plugin and add your own custom image sign over all media images uploaded in your blog.

→ Download Image watermark