Change WordPress password when ‘reset password’ is not working

Imagine a situation when you forgot the password of your admin account of your WordPress site, and ‘reset password’ is not functioning. Or even, you cannot remember the email you used for it. You cannot access the wp-admin area. Now what?

Well, there’s a solution. You can change the password from phpMyAdmin without knowing previous password.

So, what is phpMyAdmin and where do I find this?
Okay, phpMyAdmin is a database administration tool that comes with most of the hosting services. You can find this from your cPanel.

Well, now what?
Open phpMyAdmin and choose the database that your WordPress uses from the list at the left. Click on it.
Choose the database
If you do not know the database name, open wp-config.php from root directory of the WordPress installation, maybe with an FTP client like FileZilla or from your cPanel’s file manager. Then search for DB_NAME constant. It’ll look like this-

Okay. Now after clicking the database name in phpMyAdmin, it’ll expand database tables in the right side. Click on wp_users.
Click wp_users
This name may vary with any prefix instead of wp. It may be foo_users or bar_users or anything else.

Next, find your username that you want to change password of and click edit.
Find username and click edit
It’ll open an editor page.

See the screenshot carefully.
Set new password
1. Choose MD5 from Functions column and user_pass row.
2. Type your new password in Value column and user_pass row.
3. Click Go.

Bah! You are done with this struggle. Now go login with your new password and have fun.

Feel free to ask me, if you have any questions. I appreciate if your share this post.

How to stop WordPress from generating multiple image sizes

When you upload an image using the media uploader of your WordPress site, it creates multiple sizes of that image. By default, WordPress creates 4 additional sizes, but your theme and/or plugin(s) may create more sizes of that image. And it’s really a headache when you are considering your storage.

So, how to stop it?

There are 2 ways to stop WordPress from generating multiple image sizes-

1. With Coding: Set a filter to intermediate_image_sizes_advanced. It returns an array that contains the sizes. Make it return an empty array, and phew! You’re done.
Paste this into the functions.php file of your theme.

It’ll stop WP to create additional image sizes and then you’ll have only one copy of the image.

2. Without Coding: Install this plugin- Stop Generating Image Sizes and you are done.
Stop Generating Image Sizes
This plugin also allows you to choose which of the sizes you want to be prevented from creating.

How to remove default widgets (aka meta boxes) from WordPress dashboard

Remove default widgets from WordPress dashboard

WordPress comes with some default widgets, i.e Activity, Quick Draft, WordPress News etc. Sometimes you may feel disgusted to see them on dashboard and wish to remove unnecessary widgets.
There are a lot of plugins that can help you clean you dashboard. And you can do the same with a little piece of code. To say truthfully, it’s safe to use a plugin instead of coding. But, a plugin will slow down your site. Try avoiding plugin as much as you can.

Follow the steps.
1) Copy the code below. (Double-click on code to select.)

2) Open your functions.php file with an editor. functions.php file is located at your_site_directory/wp-content/theme/your_theme_name_here/functions.php

Alternatively, you can edit it from your WordPress admin panel. Go to Appearance>Edit.
Remove default widgets
Then select functions.php from the list at right side.
Remove default widgets

3) Paste the code at the end of the file. Be aware about PHP tag.
4) Save the file.
You’re done. Now go to your dashboard, no widgets are there 🙂

[Don’t do it if you are not well-known with PHP]

How to clone or add new user roles – WordPress

WordPress is probably the best CMS (Content Management System) application to create dynamic websites easily. It shortens your development time and makes you comfortable.

In my previous post, I discussed about How to rename user roles in WordPress. It will be a nice solution if you have below or equal to 5 member types in your site. But, if you need more member types?

Nothing to be worried mate. You can create new user types easily. There are 2 ways, creating a brand new role with selected capabilities or cloning an existing user role!

How to clone a user role?

How to clone a user role?Just decide, which existing user role are you going to copy or clone for your WordPress? This copy means- copying capabilities of an existing user role! Let’s assume, we are going to create a new user role ‘Writer’ which will have similar capabilities as existing user role ‘Author’.
Copy the code below and paste them into functions.php of your theme (located at ../wp-content/themes/your_theme_name/functions.php)

How to add a new user role?

How to add a new user role?This is so simple as above example. Copy the code below, open your functions.php file and paste them. It creates a new user role ‘Blogger’ who can read, (write) and edit posts, but cannot delete them. (Please go to this page to know the List of capabilities WordPress has.)

That’s it. Try it yourself and let me know if you face any difficulties.

How to rename user roles – WordPress

How to rename user roles of WordPress? By default WordPress has five user roles. They are Subscriber, Contributor, Author, Editor and Administrator. Each of them has different capabilities and access levels in WordPress where Administrator is the most powerful and Subscriber is the lowest. An Administrator can do almost everything and a Subscriber can do almost nothing! (See for details)

Let’s think, you are developing a website for booking hotels online. There will be 3 type of members. Free member, Premium member and Manager. Now what? You can assign Editor as Manager, Author as Premium member and Contributor as Free member for example. It may solve your problem, but doesn’t it look odd? Of-course. Then what is the solution?

You can rename user roles to whatever you want. Here is how to do:

How to rename user roles

  • Open your theme’s functions.php file. This file is located at ../wp-content/themes/your_theme_name/functions.php
  • Copy the code below. Double click on code to make them copyable.

  • Paste them inside <?php and ?> tags of functions.php file.
  • Save.
  • You are done.

Now go to ../wp-admin/users.php and see the changes!

 

Transfer large files from one server to another in seconds

Few days ago, I was working for one my clients from the USA. I was asked to transfer his site from BlueHost to HostGator! The task was so easy. I told him that, it may require around one hour to transfer his entire site.

But, when I logged in to the cPanel, I wonder that, total file size to be transferred is around 1GB. It’ll take two and half hours ONLY to download the site to my local server! Now what?

I used the script below.

 

How to use:

  1. Create a new file on your destination server. Say, file.php
  2. Copy the code above and paste it to file.php
  3. Go to your source server via file manager/FTP. Zip entire site.
  4. Run your file.php and give the URL of zipped file of the source. Click Submit. Wait for seconds till the page reloads.
  5. Go to destination server. Amazing! The file is here! Unzip it.
  6. You are done! It’ll take dramatically very small time!

Note: if you wish to move the files to a specific folder in the destination, just ‘uncomment’ line# 13 and replace download with your own folder name.

Visitor Counter for WordPress (Hit Counter)

You often wanted to show a hit counter for your WordPress site. There are a lot of plugins to solve this issue. But why are you making your site slower? Never use a plugin, if it’s really not needed.
Avoid plugins if you can do it yourself by a small code snippet. Here is how to add a visitor counter for WordPress.

Create a visitor counter

Step-1:
Open your functions.php file with an editor. Add the code below then save it.

Step-2:
Add following code to single.php

Step-3:
This is the final step. Decide where do you want to show the hit counter. Place this code into your template. It’s a good idea to show his counter in the footer area. But, choice is yours.

You’re done. Visit your site, it’ll show hit counter. Keep counting your visitors.

Get back to an older version of WordPress (Downgrade WP)

Usually we upgrade an application for some reasons like security, new features etc. But, sometimes we may need to downgrade WP (or any application).

Few days ago, I was using a theme for one of my WordPress sites. A newer version of WP released and I upgraded it. Then I faced a problem. The pagination system was not working with new version of WP. So, I had to downgrade WP!

You may face this problem too! What should you do? Because, unlike upgrading, there is no option for downgrading your WordPress!

See, how did I downgrade WP-

1) You must know, which version of WP you were using. Go to this link and download that version. Link: http://wordpress.org/download/release-archive/
2) Extract (Unzip) that ZIP file in you computer. You’ll find a lot of files including folders named wp-admin, wp-contents and wp-includes. Copy wp-admin and wp-includes folders. See the image below:

Downgrade WP

3) Delete wp-admin and wp-includes folders from your server.
৪) Upload wp-admin and wp-includes folders to your server.

Hope, your problem will be solved. I followed this way and I was succeeded. Whole process is silly risky. So, be careful. I’ll not be liable for any damages. For additional security, you may back-up your old files.

Bengali Digits in WordPress

As you’re reading this article, I guess you are a proud WordPressian and you have interests on WordPress like me.

Have you ever wanted to convert the digits into Bengali (or other language) while translating a site? You can easily translate your site to another language using a language pack. And absolutely it was never been difficult to convert digits to Bengali/Bangla or whatever language you want!

Bengali Digits in WordPress

Just follow the instructions I’m giving below. But, please do not do this, if you do not have basic knowledge of PHP.

bengali digits in wordpress

1. Find out the file named functions.php. This file is located in wp-content/themes/your_theme/functions.php

2. Open it with NotePad or any other editor.

3. Copy the code below

4. Paste them in functions.php file. Be careful about right placement. Keep them inside <?php and ?> tag.

5. Save the file.

6. Now reload/refresh your website and see the changes.

[Note: in 4th line, I wrote

Where ১,২,৩,৪,৫,৬,৭,৮,৯,০ are the numbers from Bengali Language. If you want to use your own digits, just put them separated with commas.]