Mở file functions.php trong child theme của bạn (nếu chưa có child theme, bạn nên tạo child theme để tránh mất thay đổi khi update theme). Thêm đoạn code sau:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
// Ẩn UX Builder và chặn truy cập trực tiếp nếu không phải Admin function webdy_hide_ux_builder_for_non_admins() { if (!current_user_can('administrator')) { // Ẩn menu UX Builder trong Admin Menu add_action('admin_menu', function() { remove_menu_page('ux-builder'); }, 999); // Chặn truy cập trực tiếp vào UX Builder qua URL add_action('admin_init', function() { $current_url = $_SERVER['REQUEST_URI']; if (strpos($current_url, 'app=uxbuilder') !== false) { wp_die('Bạn không có quyền truy cập UX Builder.'); } }); // Ẩn nút "Edit with UX Builder" trong trang chỉnh sửa bài/post add_action('add_meta_boxes', function() { remove_meta_box('ux_builder_edit_button', 'page', 'side'); remove_meta_box('ux_builder_edit_button', 'post', 'side'); // Nếu có Custom Post Type thì thêm dòng này: // remove_meta_box('ux_builder_edit_button', 'ten_custom_post_type', 'side'); }, 999); } } add_action('init', 'webdy_hide_ux_builder_for_non_admins'); |