Edit comments and number of categories in WordPress


Edit comments and number of categories in WordPress - When moving WordPress from one server to another, sometimes information is lost. Although this does not happen often, you encounter wrong comments or categories at WordPress.

It is misleading, confusing the visitor and then influencing any data you collect in that respect. For example, visitors see you have 0 posts in a category when it stores more than 400 posts.

Today, I will show you how to correct the number of categories and comment data at WordPress after importing.

Before you get started, understand this means you will need to do a bit of coding work. However, it is not too difficult.

Also, note that this fix doesn't work with PHP 7.

Back up your website

index-in-word-in-wordpress directory

It is always a good idea to create a WordPress backup when making any modifications. In case of a problem, easily recover the website.

If you're not sure how to do this, I recommend the UpdraftPlus plugin. This is a great tool you are allowed to save your own cloud account like Dropbox or Google Drive.

Although I did not foresee any real problems from this tutorial, it is safer to apologize.

Create Category-fix.php

Today, we will create a new file named, Category-fix.php. There are several ways you can do this:

  • Create a Notepad file on the computer.

  • Use the File Manager tool in cPanel.

  • Use plugins in WordPress like WP File Manager.

For this article, I will keep it simple and just use File Manager in cPanel.

In any case, create a new file and call it, Category-fix.php.


Edit the new file.


Paste this code into the file:


Replace DB DB_HOST, DB_USER, DB_PASSWORD and DB_NAME with your own login information. This will be the information for accessing the WordPress database.

Be sure to include the single quote character before, after the server, the user, the password, the database name.

For example, DB_HOST looks like this:


If you are unsure of this information, you find it in the wp-config.php file.


Save the file after adding the code.


See more: Who has viewed my facebook

If you are using Notepad or other text editor

Once you've added the code to something like Notepad, you'll obviously save the file as category-fix.php. Next, you will want to use an FTP program like FileZilla or File Manager at cPanel to upload the file.


When uploading a file, make sure you are saving it in the root directory. This is the main directory on the actual website. You will see the same folder as in this picture:


Run the file

Open the web browser and then access the file. The address will look like this:



Of course, you will want to change yourwebsitename.com name to your own domain name.

The file will then scan through the database and then correct the number.

Delete the file

After running the file, verify that the comment and the directory number in WordPress are correct, you will need to delete the category-fix.php file.


It is simply safer to delete this file from the system. It prevents a variety of problems, most of which are security threats.

What happens if you get HTTP ERROR 500?

In most cases, the HTTP HTTP ERROR 500 screen is generated because you are using PHP 7 when trying this fix. The latest version from PHP has eliminated the ability to access databases in such a way.

You will need to find out which PHP version you are using to eliminate this problem. You access this tool from the "Select PHP Version" version tool in cPanel.


The update also makes many other adjustments to prevent older bug fixes from working.

You also want to check the file or website directory permissions. Unauthorized rights are also likely to cause this error.

If this is not the case, you have to do a few in-depth troubleshooting. Error 500 is a general problem caused by a series of problems.

It is not just a matter of aesthetics

When the number of WordPress directories is wrong or the website displays an incorrect number of comments, it makes the user ignore. For example, the category appears to be empty prompting users not to explore content.

Keep the website in optimal condition.

Nguyen Diep

My name is Nguyen Manh Cuong. I was born in a poor village in Ba Vi district, HA NOI province - windy and sunny land. Currently

Post a Comment

Previous Post Next Post

Đọc nhiều trong tuần

10 Grands Sites de modèles PowerPoint gratuit
10 Grands Sites de modèles PowerPoint gratuit

PowerPoint est toujours le roi quand il vient à un logiciel de présentation. Il a été autour depuis des siècles et chaque nouvelle version ajoute plus de fonctionnalités et rend …

17 best home jobs in 2020
17 best home jobs in 2020

Earning Money blog access_time April 13, 2020 hourglass_empty 28 least Read Finding work from home is easier thanks to high technology. Not only suitable for tho…

How much RAM is the iPhone 12 Pro?
How much RAM is the iPhone 12 Pro?

The RAM of the iPhone 12 Pro is up to 6GB.
Based on information in the latest Xcode beta from Hiraku, it can be said that both of Apple's new iPhone 12 Pro models have 6GB of R…


JavaScript is a programming language of HTML and WEB. It is lightweight and most commonly used as part of web pages, but their implementation allows Client-Side scripts to interac…