Code ẩn plugin khỏi danh sách plugin trong dashboard

Bạn là developer, bạn cài web cho khách, bạn có vài plugin bạn không muốn khách đụng vào. Đoạn code sau sẽ giúp bạn ẩn các plugin đó đi. Hãy copy nó bỏ vào functions.php nhé

functionbnix_hide_plugin() {global$wp_list_table;$hidearr = array('wordfence/wordfence.php', 'updraftplus/updraftplus.php', 'wp-security-audit-log/wp-security-audit-log.php', 'simple-history/index.php', 'user-switching/user-switching.php'  );$myplugins = $wp_list_table->items;foreach ($myplugins as $key => $val) {if (in_array($key,$hidearr)) {unset($wp_list_table->items[$key]);    }  }}add_action('pre_current_active_plugins', 'bnix_hide_plugin');

Bạn cần ẩn plugin nào thì thêm vào array $hidearr như trong code. ‘ten-thu-muc/ten-file-plugin-chinh’,

Chúc các bạn sử dụng thành công!

5/5 - (51 bình chọn)
Đăng ký
Thông báo về
guest
0 Bình Luận
Oldest
Newest Most Voted
Inline Feedbacks
Xem tất cả
0
Rất thích suy nghĩ của bạn, hãy bình luận.x
()
x