Lỗi không thể update wordpress - Khóa comment

 Khi update wordpress mà cứ bị báo lỗi thế này thì làm sao????



Truy cập vào file wp-config.php của bạn (qua FTP hoặc File Manager).

Thêm dòng sau vào trước dòng /* That's all, stop editing! Happy publishing. */:

define('FS_METHOD', 'direct');



Còn không được nữa thì thêm vào function.php của theme hiện tại nhé


Xóa và ẩn comment

1. Thay thế file comment.php ở theme bằng đoạn mã sau

<?php

// Vô hiệu hóa bình luận – file này không còn hiển thị nội dung gì nữa

return;

2. Muốn khóa và tắt hết comment thì thêm vào file function.php của theme đang sử dụng nhé

// Tắt bình luận toàn bộ

add_action('admin_init', function () {

    // Tắt bình luận cho bài viết

    remove_post_type_support('post', 'comments');

    remove_post_type_support('page', 'comments');

    

    // Đóng bình luận với bài viết đã có

    global $pagenow;

    if ($pagenow === 'edit-comments.php') {

        wp_redirect(admin_url());

        exit;

    }


    // Ẩn menu bình luận

    remove_menu_page('edit-comments.php');

});


// Chặn bình luận gửi đến

add_filter('comments_open', '__return_false', 20, 2);

add_filter('pings_open', '__return_false', 20, 2);



Xóa toàn bộ comment có sẵn bằng sql

DELETE FROM wp_comments;

DELETE FROM wp_commentmeta;




Post a Comment

Mới hơn Cũ hơn