Để bảo vệ SSH của bạn bằng Two-Factor Authentication (2FA), bạn có thể sử dụng công cụ Google Authenticator hoặc Authy. Dưới đây là hướng dẫn chi tiết về cách cấu hình SSH với Google Authenticator để yêu cầu mã xác minh thứ hai khi đăng nhập vào server. Bước 1: Cài đặt Google Authenticator…
Lưu trữ tác giả: admin
Dán vào function.php
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
/* * Check spam cf7 bằng scroll * Author: levantoan.com * */ add_filter('wpcf7_form_elements', 'devvn_check_scroll_form_cf7'); function devvn_check_scroll_form_cf7($html){ $html = '<div style="display: none"><p><span class="wpcf7-form-control-wrap" data-name="devvn-scroll"><input size="40" class="wpcf7-form-control wpcf7-text" aria-invalid="false" value="0" type="text" name="devvn-scroll"></span></p></div>' . $html; return $html; } add_action('wpcf7_posted_data', 'devvn_check_scroll_form_cf7_vaild'); function devvn_check_scroll_form_cf7_vaild($posted_data) { $submission = WPCF7_Submission::get_instance(); $scroll = isset($posted_data['devvn-scroll']) ? intval($posted_data['devvn-scroll']) : 0; //nếu form ở ngay trên đầu page thì thay 5000 thành số nhỏ hơn. ví dụ 200 if (!$scroll || $scroll <= 5000) { $submission->set_status( 'spam' ); $submission->set_response( 'You are spamer' ); } unset($posted_data['devvn-scroll']); return $posted_data; } add_action('wp_footer', function (){ ?> <script> const scrollInputs = document.querySelectorAll('input[name="devvn-scroll"]'); if(scrollInputs.length > 0) { let accumulatedScroll = 0; function devvnCheckScroll() { accumulatedScroll += window.scrollY; scrollInputs.forEach(input => { input.value = accumulatedScroll; }); //nếu form ở ngay trên đầu page thì thay 6000 thành số nhỏ hơn. ví dụ 300 if (accumulatedScroll >= 6000) { window.removeEventListener('scroll', devvnCheckScroll); } } window.addEventListener('scroll', devvnCheckScroll); } </script> <?php }); |
Dùng hostnamectl để xác định loại máy chủ Lệnh sau có thể cho bạn biết thông tin cơ bản về máy chủ:
1 |
hostnamectl |
Bảo mật mật khẩu SSH là một yếu tố rất quan trọng để bảo vệ máy chủ của bạn khỏi các cuộc tấn công từ bên ngoài. Dưới đây là một số biện pháp mà bạn có thể áp dụng để bảo mật mật khẩu SSH của mình: 1. Sử dụng SSH Key thay vì…
Thêm đoạn code sau vào file functions.php:
1 2 3 4 |
function wpvn_no_meta_viewport() { return false; } add_filter( 'flatsome_viewport_meta', 'wpvn_no_meta_viewport' ); |
Đối với những bạn sử dụng VPS có cài đặt sẵn DirectAdmin có thể sẽ gặp phải tình trạng không gửi được email thông qua SMTP. Nguyên nhân có thể do firewall CSF đã chặn SMTP nên quý khách không thể gửi được email. Bước 1: Đăng nhập VPS thông qua SFTP với winscp, download Winscp tại đây: https://winscp.net/eng/download.php…
Với sự phát triển nhanh chóng của trí tuệ nhân tạo (AI), nhu cầu phát hiện và xác minh nội dung do AI tạo ra đang trở thành một lĩnh vực quan trọng. Dưới đây là danh sách 10 công cụ phát hiện AI hàng đầu, đáng tin cậy và phổ biến nhất hiện nay….
Dán CSS vào
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 32 33 34 35 36 37 38 39 40 41 42 43 |
.product-small .box-image:hover::before{ -webkit-animation:shine .75s;animation:shine .75s } @-webkit-keyframes shine{ 100%{left:125%} } @keyframes shine{ 100%{left:125%} } .product-small .box-image::before{ position:absolute; top:0; left:-75%; z-index:2; display:block; content:''; width:50%; height:100%; background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,.3) 100%); background:linear-gradient(to right,rgba(255,255,255,0) 0,rgba(255,255,255,.3) 100%); -webkit-transform:skewX(-25deg);transform:skewX(-25deg) } |
Thêm đoạn code sau vào functions.php
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 32 33 34 |
// Xóa /category/ khỏi URL function remove_category_base($string, $term) { if ($term->taxonomy == 'category') { $string = str_replace('/category/', '/', $string); } return $string; } add_filter('term_link', 'remove_category_base', 10, 2); // Thêm rewrite rules để tránh lỗi 404 function add_category_rewrite_rules($wp_rewrite) { $rules = []; $categories = get_categories(['hide_empty' => false]); foreach ($categories as $category) { $slug = $category->slug; $rules['(' . $slug . ')/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?category_name=' . $slug . '&feed=$matches[2]'; $rules['(' . $slug . ')/page/([0-9]{1,})/?$'] = 'index.php?category_name=' . $slug . '&paged=$matches[2]'; $rules['(' . $slug . ')/?$'] = 'index.php?category_name=' . $slug; } $wp_rewrite->rules = $rules + $wp_rewrite->rules; } add_filter('generate_rewrite_rules', 'add_category_rewrite_rules'); // Redirect URL cũ chứa /category/ sang URL mới function redirect_old_category_links() { if (strpos($_SERVER['REQUEST_URI'], '/category/') !== false) { $new_url = str_replace('/category/', '/', $_SERVER['REQUEST_URI']); wp_redirect(home_url($new_url), 301); exit(); } } add_action('template_redirect', 'redirect_old_category_links'); |
Làm mới cấu trúc Permalink Sau khi thêm code vào file functions.php, bạn cần cập nhật lại cấu trúc đường dẫn tĩnh: Vào Settings (Cài đặt) > Permalinks (Đường dẫn tĩnh). Nhấn nút Save Changes (Lưu thay đổi) mà không cần chỉnh sửa gì. Việc này buộc WordPress…