Bỏ qua đến nội dung
Bỏ qua điều hướng
Đăng nhập
TIN TỨC & NỘI DUNG

Change the table prefix for WordPress

Tìm kiếm
Home Thủ thuật thiết kế webs Bài viết

Change the table prefix for WordPress

In this guide, we explain how to change the database table prefix of your WordPress installation. The default database table prefix for WordPress is ‘wp_’; however, we recommend changing it. The reason for this is that all your login details are stored in your database, making your WordPress tables very popular targets for hackers. Changing the prefix makes it harder for them to break in.

Change the table prefix for WordPress

Change the table prefix for WordPress

Supper admin 2022-02-25 08:49:22 0 Bình Luận 284 Lượt xem

Change the table prefix for WordPress


 https://help.one.com/hc/en-us/articles/360002107438-Change-the-table-prefix-for-WordPress-

In this guide, we explain how to change the database table prefix of your WordPress installation.

The default database table prefix for WordPress is ‘wp_’; however, we recommend changing it. The reason for this is that all your login details are stored in your database, making your WordPress tables very popular targets for hackers. Changing the prefix makes it harder for them to break in.

Note: If you have used the 1-click installer to install WordPress, then you already have a custom table prefix.

You need to change the table prefix in three places:

  1.  

Step 1 – Change the table prefix in wp-config.php

  1. Log into the One.com control panel.
  2. Open File Manager under Files & Security.
  3. Locate the file wp-config.php and check the box to select it.
  4. Click Edit in the menu bar at the top of your screen.
  5. Locate the following entry:
$table_prefix = 'wp_';
  1. Replace ‘wp_’ with something else; in this case, we replaced it with ‘david_’:
$table_prefix = 'david_';
  1. Click Save in the top-left corner.

Step 2 – Change the table prefix in the database

  1. Open your database in PhpMyAdmin.
  2. Click on the database name in the menu to the left to unfold all tables.
  3. Select all tables that start with wp_; you should have 12 in total.
  4. Click With selected to open the drop-down menu and select Replace table prefix.
  5. Type in wp_ in the From-field, and the new name in the To-field, in this example, david_.
  6. Click Continue to make the change.

Step 3 – Replace all references to the old prefix

In some settings that are stored in your database, WordPress still refers to the old table prefix. To complete changing the prefix, you need to replace these with your new prefix.

  1. Click on the SQL tab in the menu at the top of the screen.
  2. Copy and paste in the following commands:
update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_capabilities' where meta_key = 'OLDPREFIX_capabilities';
update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_user_level' where meta_key = 'OLDPREFIX_user_level';
update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_autosave_draft_ids' where meta_key = 'OLDPREFIX_autosave_draft_ids';
update NEWPREFIX_options set option_name = 'NEWPREFIX_user_roles' where option_name = 'OLDPREFIX_user_roles';
  1. Replace OLDPREFIX and NEWPREFIX, with your own old and new prefix. Like in the example below, where we replace wp_ with david_:
update david_usermeta set meta_key = 'david_capabilities' where meta_key = 'wp_capabilities';
update david_usermeta set meta_key = 'david_user_level' where meta_key = 'wp_user_level';
update david_usermeta set meta_key = 'david_autosave_draft_ids' where meta_key = 'wp_autosave_draft_ids';
update david_options set option_name = 'david_user_roles' where option_name = 'wp_user_roles';
  1. Click on Go to run the commands and complete the change.

You are done. The prefix of the WordPress tables has now been changed.

ĐÁNH GIÁ NỘI DUNG 0.0/5 0 lượt đánh giá
Bạn thấy nội dung này thế nào?
Mỗi trình duyệt/tài khoản được chấm lại sau 24 giờ.
Báo bài lỗiGiúp MT.Net.VN phát hiện nội dung cần kiểm tra
Báo lỗi được ghi vào hệ thống để Admin kiểm tra. Không dùng chức năng này để gửi hỗ trợ cá nhân.
Home Dịch vụ Khóa học CPanel