
1. BACKUP THƯ MỤC UPLOADS & THEMES
Lưu lại config kết nối với database còn lại xóa hết tải wordpress mới nhất lên kết nối lại.
2. TÀI KHOẢN
– Xóa các tài khoản nghi vấn hack/hack đi
– Đổi mật khẩu tất cả tài khoản
– Tắt mật khẩu ứng dụng
– Bật xác minh 2 bước
3. COMMENT
Nhớ xóa hết comment trước khi chặn thêm code vào function.php
/**
* Tắt và xóa hoàn toàn tính năng Comment trong WordPress
*/
// 1. Tắt hỗ trợ comment và pingbacks cho tất cả các post type
add_action('admin_init', function () {
// Lấy tất cả post types hiện có
$post_types = get_post_types();
foreach ($post_types as $post_type) {
if (post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
remove_post_type_support($post_type, 'trackbacks');
}
}
});
// 2. Đóng bình luận ở phía Frontend
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
// 3. Ẩn các bình luận đã có trên Frontend
add_filter('comments_array', '__return_empty_array', 10, 2);
// 4. Xóa menu "Bình luận" (Comments) trong WP-Admin
add_action('admin_menu', function () {
remove_menu_page('edit-comments.php');
});
// 5. Chuyển hướng người dùng nếu họ cố truy cập trực tiếp vào trang quản lý comment (edit-comments.php)
add_action('admin_init', function () {
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
});
// 6. Xóa icon/thông báo Bình luận trên Admin Bar
add_action('wp_before_admin_bar_render', function () {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('comments');
});
// 7. Tắt Comment REST API Endpoints (Ngăn gửi comment qua API)
add_filter('rest_endpoints', function ($endpoints) {
if (isset($endpoints['/wp/v2/comments'])) {
unset($endpoints['/wp/v2/comments']);
}
if (isset($endpoints['/wp/v2/comments/(?P<id>[\d]+)'])) {
unset($endpoints['/wp/v2/comments/(?P<id>[\d]+)']);
}
return $endpoints;
});
Chắc chắn nữa thì xóa luôn 2 bảng comment trong database
DROP TABLE IF EXISTS
wp_commentmeta,
wp_comments;
2. VÔ HIỆU HÓA REST API và XML-RPC
# Chặn hoàn toàn XML-RPC
<Files xmlrpc.php>
Order Deny,Allow
Deny from all
</Files>
# Chặn tạo bài viết mới qua REST API đối với user chưa đăng nhập
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} ^/wp-json/wp/v2/posts [NC]
RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_ [NC]
RewriteRule ^ - [F,L]
</IfModule>
3. PLUGIN BẢO MẬT
Kadence Security – Password, Two Factor Authentication, and Brute Force Protection

