Last active
July 1, 2021 02:28
-
-
Save manh-trinhquoc/fec5b96ebce21b40802466dfb8ff88ae to your computer and use it in GitHub Desktop.
snippet hay dùng trong wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $upgrading = 1617634719; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* cách can thiệp vào giá trị acf khi save post | |
*/ | |
add_action('acf/save_post', 'my_acf_save_post', 5); | |
function my_acf_save_post( $post_id ) { | |
// Get previous values. | |
// $prev_values = get_fields( $post_id ); | |
// Get submitted values. | |
$ma_so_can_ho_old = $_POST['acf']['field_5edddd1c81c20']['field_5edddbea81c19']; | |
$ma_so_can_ho_new = $ma_so_can_ho_old; | |
$id_can_ho_duplicate = 0; | |
$id_can_ho_duplicate = array(); | |
$error = false; | |
$something_went_wrong = false; | |
$list_can_ho = array();//query danh sách căn hộ lấy mã số căn hộ | |
$args = array( | |
'post_type' => 'can-ho', | |
'posts_per_page' => -1, | |
); | |
$loop = new WP_Query ($args); | |
if( $loop->have_posts() ) : while ( $loop->have_posts() ): $loop->the_post(); | |
$ma_so_can_ho_khac = get_field('group_info')['ma_so_can_ho']; | |
$id_can_ho_khac = get_the_ID(); | |
if(($ma_so_can_ho_khac == $ma_so_can_ho_old) && ($post_id != $id_can_ho_khac)) { | |
$ma_so_can_ho_new = $ma_so_can_ho_old.'_1'; | |
$something_went_wrong = true; | |
$id_can_ho_duplicate = $id_can_ho_khac; | |
} | |
endwhile; endif; | |
wp_reset_query(); | |
if ($something_went_wrong) { | |
$error = new WP_Error('duplicate_ma_so_can_ho', "Mã số căn hộ đã tồn tại. Hãy thử với mã số căn hộ khác"); | |
} | |
if ($error) { | |
// Handle error. | |
if(!session_id()) { | |
session_start(); | |
} | |
$_SESSION['error_duplicate_ma_so_can_ho_message'] = $error->get_error_message('duplicate_ma_so_can_ho'); | |
$_SESSION['error_duplicate_ma_so_can_ho_id_can_ho_duplicate'] = $id_can_ho_duplicate; | |
$_POST['acf']['field_5edddd1c81c20']['field_5edddbea81c19'] = $ma_so_can_ho_new; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* tạo cột custom column cột có thể sort được ở trang admin taxonomy chuyên mục câu hỏi | |
*/ | |
function custom_edit_chuyen_muc_cau_hoi_columns($columns) { | |
// ẩn cột language | |
unset($columns['language']); | |
// thêm cột số thứ tự | |
return array_merge ( $columns, array ( | |
'danh_sach_chuyen_muc_cau_hoi_stt' => __ ( 'Số thứ tự' ), | |
) ); | |
} | |
add_filter( 'manage_edit-chuyen-muc-cau-hoi_columns', 'custom_edit_chuyen_muc_cau_hoi_columns' ); | |
function custom_chuyen_muc_cau_hoi_column( $content,$column_name,$term_id ) { | |
switch ( $column_name ) { | |
case 'danh_sach_chuyen_muc_cau_hoi_stt' : | |
$content = get_field('stt','term_'.$term_id); | |
break; | |
} | |
return $content; | |
} | |
add_filter( 'manage_chuyen-muc-cau-hoi_custom_column' , 'custom_chuyen_muc_cau_hoi_column', 10, 3 ); | |
function custom_chuyen_muc_cau_hoi_sort_order( $columns ) | |
{ | |
$columns['danh_sach_chuyen_muc_cau_hoi_stt'] = 'danh_sach_chuyen_muc_cau_hoi_stt'; | |
return $columns; | |
} | |
add_filter( 'manage_edit-chuyen-muc-cau-hoi_sortable_columns', 'custom_chuyen_muc_cau_hoi_sort_order' ); | |
function uc_order_term( $wp_query ) { | |
$args = func_get_args(); //lấy toàn bộ args làm array | |
$query_orderby = $wp_query->query_vars['orderby']; | |
// var_dump($query_orderby); | |
// var_dump($wp_query); | |
if ( 'danh_sach_chuyen_muc_cau_hoi_stt' == $query_orderby ) { | |
// var_dump( $wp_query->query_vars); | |
$order = $wp_query->query_vars['order']; | |
$wp_query->query( | |
array( | |
'orderby' => 'meta_value_num', | |
'order' => $order, | |
'meta_key' => 'stt', | |
) | |
); | |
} | |
} | |
add_action( 'pre_get_terms', 'uc_order_term'); | |
/** | |
* cách để ko cho user thêm, xóa, sửa bài viết thuộc cpt | |
*/ | |
//B1: cài thêm plugin phân quyền Capability Manager Enhanced | |
//B2; thêm code sau | |
add_filter( 'map_meta_cap', function ( $caps, $cap, $user_id, $args ) { | |
// Nothing to do | |
if( 'delete_post' !== $cap || empty( $args[0] ) ) | |
return $caps; | |
// Target the payment and transaction post types | |
if( in_array( get_post_type( $args[0] ), [ 'subscribe', '' ], true ) ) | |
$caps[] = 'do_not_allow'; | |
return $caps; | |
}, 10, 4 ); | |
function fix_capability_create(){ | |
$post_types = get_post_types( array('name' => 'subscribe'),'objects' ); | |
foreach ( $post_types as $post_type ) { | |
$cap = "create_".$post_type->name; | |
$post_type->cap->create_posts = $cap; | |
map_meta_cap( $cap, 1); | |
} | |
} | |
add_action( 'init', 'fix_capability_create',100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php_value upload_max_filesize 64M | |
php_value post_max_size 64M | |
php_value max_execution_time 300 | |
php_value max_input_time 300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$img_base = get_template_directory_uri().'/assets/images/'; | |
define('IMG_BASE', $img_base); | |
global $is_desktop; | |
echo '<script> var is_desktop='; | |
echo $is_desktop ? 'true' : 'false'; | |
echo '</script>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# iThemes Security Config Details: 2 | |
# Pass through Authorization header. | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTP:Authorization} ^(.*) | |
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] | |
</IfModule> | |
# Enable HackRepair.com's blocklist feature - Security > Settings > Banned Users > Default Blocklist | |
# Start HackRepair.com Blacklist | |
RewriteEngine on | |
# Start Abuse Agent Blocking | |
RewriteCond %{HTTP_USER_AGENT} "^Mozilla.*Indy" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Mozilla.*NEWT" [NC,OR] | |
# RewriteCond %{HTTP_USER_AGENT} "^$" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Maxthon$" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^SeaMonkey$" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Acunetix" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^binlar" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^BlackWidow" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Bolt 0" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^BOT for JCE" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Bot mailto\:craftbot@yahoo\.com" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^casper" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^checkprivacy" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^ChinaClaw" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^clshttp" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^cmsworldmap" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Custo" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Default Browser 0" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^diavol" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^DIIbot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^DISCo" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^dotbot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Download Demon" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^eCatch" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^EirGrabber" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^EmailCollector" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^EmailSiphon" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^EmailWolf" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Express WebPictures" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^extract" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^ExtractorPro" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^EyeNetIE" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^feedfinder" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^FHscan" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^FlashGet" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^flicky" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^g00g1e" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^GetRight" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^GetWeb\!" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Go\!Zilla" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Go\-Ahead\-Got\-It" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^grab" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^GrabNet" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Grafula" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^harvest" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^HMView" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Image Stripper" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Image Sucker" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^InterGET" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Internet Ninja" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^InternetSeer\.com" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^jakarta" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Java" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^JetCar" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^JOC Web Spider" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^kanagawa" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^kmccrew" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^larbin" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^LeechFTP" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^libwww" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Mass Downloader" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^microsoft\.url" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^MIDown tool" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^miner" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Mister PiX" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^MSFrontPage" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Navroad" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^NearSite" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Net Vampire" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^NetAnts" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^NetSpider" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^NetZIP" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^nutch" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Octopus" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Offline Explorer" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Offline Navigator" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^PageGrabber" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Papa Foto" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^pavuk" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^pcBrowser" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^PeoplePal" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^planetwork" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^psbot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^purebot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^pycurl" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^RealDownload" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^ReGet" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Rippers 0" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^sitecheck\.internetseer\.com" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^SiteSnagger" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^skygrid" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^SmartDownload" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^sucker" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^SuperBot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^SuperHTTP" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Surfbot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^tAkeOut" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Teleport Pro" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Toata dragostea mea pentru diavola" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^turnit" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^vikspider" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^VoidEYE" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Web Image Collector" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WebAuto" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WebBandit" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WebCopier" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WebFetch" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WebGo IS" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WebLeacher" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WebReaper" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WebSauger" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Website eXtractor" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Website Quester" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WebStripper" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WebWhacker" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WebZIP" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Widow" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WPScan" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WWW\-Mechanize" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^WWWOFFLE" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Xaldon WebSpider" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^Zeus" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "^zmeu" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "360Spider" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "CazoodleBot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "discobot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "EasouSpider" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "ecxi" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "GT\:\:WWW" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "heritrix" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "HTTP\:\:Lite" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "HTTrack" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "ia_archiver" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "id\-search" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "IDBot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "Indy Library" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "IRLbot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "ISC Systems iRc Search 2\.1" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "LinksCrawler" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "LinksManager\.com_bot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "linkwalker" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "lwp\-trivial" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "MFC_Tear_Sample" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "Microsoft URL Control" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "Missigua Locator" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "MJ12bot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "panscient\.com" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "PECL\:\:HTTP" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "PHPCrawl" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "PleaseCrawl" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "SBIder" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "SearchmetricsBot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "Snoopy" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "Steeler" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "URI\:\:Fetch" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "urllib" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "Web Sucker" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "webalta" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "WebCollage" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "Wells Search II" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "WEP Search" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "XoviBot" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "YisouSpider" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "zermelo" [NC,OR] | |
RewriteCond %{HTTP_USER_AGENT} "ZyBorg" [NC,OR] | |
# End Abuse Agent Blocking | |
# Start Abuse HTTP Referrer Blocking | |
RewriteCond %{HTTP_REFERER} "^https?://(?:[^/]+\.)?semalt\.com" [NC,OR] | |
RewriteCond %{HTTP_REFERER} "^https?://(?:[^/]+\.)?kambasoft\.com" [NC,OR] | |
RewriteCond %{HTTP_REFERER} "^https?://(?:[^/]+\.)?savetubevideo\.com" [NC] | |
# End Abuse HTTP Referrer Blocking | |
RewriteRule ^.* - [F,L] | |
# End HackRepair.com Blacklist, http://pastebin.com/u/hackrepair | |
# Ban Hosts - Security > Settings > Banned Users | |
SetEnvIF REMOTE_ADDR "^72\.14\.199\.204$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^72\.14\.199\.204$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^72\.14\.199\.204$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^43\.247\.156\.90$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^43\.247\.156\.90$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^43\.247\.156\.90$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^180\.151\.11\.246$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^180\.151\.11\.246$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^180\.151\.11\.246$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^27\.6\.2\.234$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^27\.6\.2\.234$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^27\.6\.2\.234$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^185\.14\.249\.10$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^185\.14\.249\.10$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^185\.14\.249\.10$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^191\.179\.134\.124$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^191\.179\.134\.124$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^191\.179\.134\.124$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^185\.106\.28\.105$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^185\.106\.28\.105$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^185\.106\.28\.105$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^49\.36\.73\.53$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^49\.36\.73\.53$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^49\.36\.73\.53$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^90\.191\.209\.0$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^90\.191\.209\.0$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^90\.191\.209\.0$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^143\.202\.172\.109$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^143\.202\.172\.109$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^143\.202\.172\.109$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^78\.136\.133\.25$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^78\.136\.133\.25$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^78\.136\.133\.25$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^39\.40\.167\.123$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^39\.40\.167\.123$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^39\.40\.167\.123$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^147\.91\.36\.2$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^147\.91\.36\.2$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^147\.91\.36\.2$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^39\.40\.40\.75$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^39\.40\.40\.75$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^39\.40\.40\.75$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^103\.216\.212\.173$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^103\.216\.212\.173$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^103\.216\.212\.173$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^152\.32\.98\.160$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^152\.32\.98\.160$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^152\.32\.98\.160$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^112\.120\.84\.175$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^112\.120\.84\.175$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^112\.120\.84\.175$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^194\.230\.147\.133$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^194\.230\.147\.133$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^194\.230\.147\.133$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^177\.83\.241\.236$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^177\.83\.241\.236$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^177\.83\.241\.236$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^49\.36\.147\.140$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^49\.36\.147\.140$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^49\.36\.147\.140$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^152\.32\.101\.237$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^152\.32\.101\.237$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^152\.32\.101\.237$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^103\.154\.54\.124$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^103\.154\.54\.124$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^103\.154\.54\.124$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^59\.17\.227\.93$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^59\.17\.227\.93$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^59\.17\.227\.93$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^103\.151\.189\.43$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^103\.151\.189\.43$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^103\.151\.189\.43$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^88\.132\.173\.3$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^88\.132\.173\.3$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^88\.132\.173\.3$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^82\.50\.40\.63$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^82\.50\.40\.63$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^82\.50\.40\.63$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^106\.220\.241\.231$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^106\.220\.241\.231$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^106\.220\.241\.231$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^41\.104\.23\.108$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^41\.104\.23\.108$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^41\.104\.23\.108$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^197\.200\.224\.52$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^197\.200\.224\.52$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^197\.200\.224\.52$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^82\.79\.130\.92$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^82\.79\.130\.92$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^82\.79\.130\.92$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^98\.2\.236\.215$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^98\.2\.236\.215$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^98\.2\.236\.215$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^190\.80\.86\.205$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^190\.80\.86\.205$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^190\.80\.86\.205$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^178\.147\.150\.84$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^178\.147\.150\.84$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^178\.147\.150\.84$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^80\.6\.113\.97$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^80\.6\.113\.97$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^80\.6\.113\.97$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^37\.41\.98\.99$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^37\.41\.98\.99$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^37\.41\.98\.99$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^46\.103\.100\.56$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^46\.103\.100\.56$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^46\.103\.100\.56$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^46\.176\.160\.1$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^46\.176\.160\.1$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^46\.176\.160\.1$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^185\.217\.117\.192$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^185\.217\.117\.192$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^185\.217\.117\.192$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^49\.205\.82\.30$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^49\.205\.82\.30$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^49\.205\.82\.30$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^112\.197\.33\.161$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^112\.197\.33\.161$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^112\.197\.33\.161$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^183\.82\.191\.42$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^183\.82\.191\.42$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^183\.82\.191\.42$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^115\.98\.80\.45$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^115\.98\.80\.45$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^115\.98\.80\.45$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^80\.233\.55\.47$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^80\.233\.55\.47$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^80\.233\.55\.47$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^103\.225\.244\.30$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^103\.225\.244\.30$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^103\.225\.244\.30$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^188\.4\.234\.189$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^188\.4\.234\.189$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^188\.4\.234\.189$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^188\.4\.148\.93$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^188\.4\.148\.93$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^188\.4\.148\.93$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^39\.52\.83\.44$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^39\.52\.83\.44$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^39\.52\.83\.44$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^123\.231\.110\.88$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^123\.231\.110\.88$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^123\.231\.110\.88$" DenyAccess | |
SetEnvIF REMOTE_ADDR "^39\.52\.78\.100$" DenyAccess | |
SetEnvIF X-FORWARDED-FOR "^39\.52\.78\.100$" DenyAccess | |
SetEnvIF X-CLUSTER-CLIENT-IP "^39\.52\.78\.100$" DenyAccess | |
<IfModule mod_authz_core.c> | |
<RequireAll> | |
Require all granted | |
Require not env DenyAccess | |
Require not ip 72.14.199.204 | |
Require not ip 43.247.156.90 | |
Require not ip 180.151.11.246 | |
Require not ip 27.6.2.234 | |
Require not ip 185.14.249.10 | |
Require not ip 191.179.134.124 | |
Require not ip 185.106.28.105 | |
Require not ip 49.36.73.53 | |
Require not ip 90.191.209.0 | |
Require not ip 143.202.172.109 | |
Require not ip 78.136.133.25 | |
Require not ip 39.40.167.123 | |
Require not ip 147.91.36.2 | |
Require not ip 39.40.40.75 | |
Require not ip 103.216.212.173 | |
Require not ip 152.32.98.160 | |
Require not ip 112.120.84.175 | |
Require not ip 194.230.147.133 | |
Require not ip 177.83.241.236 | |
Require not ip 49.36.147.140 | |
Require not ip 152.32.101.237 | |
Require not ip 103.154.54.124 | |
Require not ip 59.17.227.93 | |
Require not ip 103.151.189.43 | |
Require not ip 88.132.173.3 | |
Require not ip 82.50.40.63 | |
Require not ip 106.220.241.231 | |
Require not ip 41.104.23.108 | |
Require not ip 197.200.224.52 | |
Require not ip 82.79.130.92 | |
Require not ip 98.2.236.215 | |
Require not ip 190.80.86.205 | |
Require not ip 178.147.150.84 | |
Require not ip 80.6.113.97 | |
Require not ip 37.41.98.99 | |
Require not ip 46.103.100.56 | |
Require not ip 46.176.160.1 | |
Require not ip 185.217.117.192 | |
Require not ip 49.205.82.30 | |
Require not ip 112.197.33.161 | |
Require not ip 183.82.191.42 | |
Require not ip 115.98.80.45 | |
Require not ip 80.233.55.47 | |
Require not ip 103.225.244.30 | |
Require not ip 188.4.234.189 | |
Require not ip 188.4.148.93 | |
Require not ip 39.52.83.44 | |
Require not ip 123.231.110.88 | |
Require not ip 39.52.78.100 | |
</RequireAll> | |
</IfModule> | |
<IfModule !mod_authz_core.c> | |
Order allow,deny | |
Allow from all | |
Deny from env=DenyAccess | |
Deny from 72.14.199.204 | |
Deny from 43.247.156.90 | |
Deny from 180.151.11.246 | |
Deny from 27.6.2.234 | |
Deny from 185.14.249.10 | |
Deny from 191.179.134.124 | |
Deny from 185.106.28.105 | |
Deny from 49.36.73.53 | |
Deny from 90.191.209.0 | |
Deny from 143.202.172.109 | |
Deny from 78.136.133.25 | |
Deny from 39.40.167.123 | |
Deny from 147.91.36.2 | |
Deny from 39.40.40.75 | |
Deny from 103.216.212.173 | |
Deny from 152.32.98.160 | |
Deny from 112.120.84.175 | |
Deny from 194.230.147.133 | |
Deny from 177.83.241.236 | |
Deny from 49.36.147.140 | |
Deny from 152.32.101.237 | |
Deny from 103.154.54.124 | |
Deny from 59.17.227.93 | |
Deny from 103.151.189.43 | |
Deny from 88.132.173.3 | |
Deny from 82.50.40.63 | |
Deny from 106.220.241.231 | |
Deny from 41.104.23.108 | |
Deny from 197.200.224.52 | |
Deny from 82.79.130.92 | |
Deny from 98.2.236.215 | |
Deny from 190.80.86.205 | |
Deny from 178.147.150.84 | |
Deny from 80.6.113.97 | |
Deny from 37.41.98.99 | |
Deny from 46.103.100.56 | |
Deny from 46.176.160.1 | |
Deny from 185.217.117.192 | |
Deny from 49.205.82.30 | |
Deny from 112.197.33.161 | |
Deny from 183.82.191.42 | |
Deny from 115.98.80.45 | |
Deny from 80.233.55.47 | |
Deny from 103.225.244.30 | |
Deny from 188.4.234.189 | |
Deny from 188.4.148.93 | |
Deny from 39.52.83.44 | |
Deny from 123.231.110.88 | |
Deny from 39.52.78.100 | |
</IfModule> | |
# Disable XML-RPC - Security > Settings > WordPress Tweaks > XML-RPC | |
<files xmlrpc.php> | |
<IfModule mod_authz_core.c> | |
Require all denied | |
</IfModule> | |
<IfModule !mod_authz_core.c> | |
Order allow,deny | |
Deny from all | |
</IfModule> | |
</files> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# Reduce Comment Spam - Security > Settings > WordPress Tweaks > Comment Spam | |
RewriteCond %{REQUEST_METHOD} POST | |
RewriteCond %{REQUEST_URI} /wp-comments-post\.php$ | |
RewriteCond %{HTTP_USER_AGENT} ^$ [OR] | |
RewriteCond %{HTTP_REFERER} !^https?://(([^/]+\.)?otomydinhthc\.com|jetpack\.wordpress\.com/jetpack-comment)(/|$) [NC] | |
RewriteRule ^.* - [F] | |
</IfModule> | |
# Protect System Files - Security > Settings > System Tweaks > System Files | |
<files .htaccess> | |
<IfModule mod_authz_core.c> | |
Require all denied | |
</IfModule> | |
<IfModule !mod_authz_core.c> | |
Order allow,deny | |
Deny from all | |
</IfModule> | |
</files> | |
<files readme.html> | |
<IfModule mod_authz_core.c> | |
Require all denied | |
</IfModule> | |
<IfModule !mod_authz_core.c> | |
Order allow,deny | |
Deny from all | |
</IfModule> | |
</files> | |
<files readme.txt> | |
<IfModule mod_authz_core.c> | |
Require all denied | |
</IfModule> | |
<IfModule !mod_authz_core.c> | |
Order allow,deny | |
Deny from all | |
</IfModule> | |
</files> | |
<files wp-config.php> | |
<IfModule mod_authz_core.c> | |
Require all denied | |
</IfModule> | |
<IfModule !mod_authz_core.c> | |
Order allow,deny | |
Deny from all | |
</IfModule> | |
</files> | |
# Disable Directory Browsing - Security > Settings > System Tweaks > Directory Browsing | |
Options -Indexes | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# Protect System Files - Security > Settings > System Tweaks > System Files | |
RewriteRule ^wp-admin/install\.php$ - [F] | |
RewriteRule ^wp-admin/includes/ - [F] | |
RewriteRule !^wp-includes/ - [S=3] | |
RewriteRule ^wp-includes/[^/]+\.php$ - [F] | |
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F] | |
RewriteRule ^wp-includes/theme-compat/ - [F] | |
RewriteCond %{REQUEST_FILENAME} -f | |
RewriteRule (^|.*/)\.(git|svn)/.* - [F] | |
# Disable PHP in Uploads - Security > Settings > System Tweaks > PHP in Uploads | |
RewriteRule ^wp\-content/uploads/.*\.(?:php[1-7]?|pht|phtml?|phps)\.?$ - [NC,F] | |
# Disable PHP in Plugins - Security > Settings > System Tweaks > PHP in Plugins | |
RewriteRule ^wp\-content/plugins/.*\.(?:php[1-7]?|pht|phtml?|phps)\.?$ - [NC,F] | |
# Disable PHP in Themes - Security > Settings > System Tweaks > PHP in Themes | |
RewriteRule ^wp\-content/themes/.*\.(?:php[1-7]?|pht|phtml?|phps)\.?$ - [NC,F] | |
# Filter Request Methods - Security > Settings > System Tweaks > Request Methods | |
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) [NC] | |
RewriteRule ^.* - [F] | |
# Filter Suspicious Query Strings in the URL - Security > Settings > System Tweaks > Suspicious Query Strings | |
RewriteCond %{QUERY_STRING} \.\.\/ [OR] | |
RewriteCond %{QUERY_STRING} \.(bash|git|hg|log|svn|swp|cvs) [NC,OR] | |
RewriteCond %{QUERY_STRING} etc/passwd [NC,OR] | |
RewriteCond %{QUERY_STRING} boot\.ini [NC,OR] | |
RewriteCond %{QUERY_STRING} ftp: [NC,OR] | |
RewriteCond %{QUERY_STRING} https?: [NC,OR] | |
RewriteCond %{QUERY_STRING} (<|%3C)script(>|%3E) [NC,OR] | |
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [NC,OR] | |
RewriteCond %{QUERY_STRING} base64_decode\( [NC,OR] | |
RewriteCond %{QUERY_STRING} %24&x [NC,OR] | |
RewriteCond %{QUERY_STRING} 127\.0 [NC,OR] | |
RewriteCond %{QUERY_STRING} (^|\W)(globals|encode|localhost|loopback)($|\W) [NC,OR] | |
RewriteCond %{QUERY_STRING} (^|\W)(concat|insert|union|declare)($|\W) [NC,OR] | |
RewriteCond %{QUERY_STRING} %[01][0-9A-F] [NC] | |
RewriteCond %{QUERY_STRING} !^loggedout=true | |
RewriteCond %{QUERY_STRING} !^action=jetpack-sso | |
RewriteCond %{QUERY_STRING} !^action=rp | |
RewriteCond %{HTTP_COOKIE} !wordpress_logged_in_ | |
RewriteCond %{HTTP_REFERER} !^http://maps\.googleapis\.com | |
RewriteRule ^.* - [F] | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
ErrorDocument 403 http://tuyendung.ksglobal.vn/ | |
ErrorDocument 404 http://tuyendung.ksglobal.vn/ | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Sitemap: http://www.example.com/sitemap.xml | |
# Google Image | |
User-agent: Googlebot-Image | |
Disallow: | |
Allow: /* | |
# Google AdSense | |
User-agent: Mediapartners-Google* | |
Disallow: | |
# digg mirror | |
User-agent: duggmirror | |
Disallow: / | |
# global | |
User-agent: * | |
Disallow: /cgi-bin/ | |
Disallow: /wp-admin/ | |
Disallow: /wp-includes/ | |
Disallow: /wp-content/plugins/ | |
Disallow: /wp-content/cache/ | |
Disallow: /wp-content/themes/ | |
Disallow: /trackback/ | |
Disallow: /feed/ | |
Disallow: /comments/ | |
Disallow: /category/*/* | |
Disallow: */trackback/ | |
Disallow: */feed/ | |
Disallow: */comments/ | |
Disallow: /*? | |
Allow: /uploads/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load file from remote address | |
# option 1: put in app folder | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /app/uploads/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*) http://capital.sunshinegroup.vn/wp-content/$1 [L,R=302,NE] | |
</IfModule> | |
# option 1: put in uploads folder | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*) http://capital.sunshinegroup.vn/wp-content/uploads/$1 [L,R=302,NE] | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* cách log các info của post | |
*/ | |
$post_cumstom = get_post_custom(); | |
console_log($post_cumstom); | |
$field_groups = acf_get_field_groups(); | |
console_log($field_groups); | |
$post_meta = get_post_meta(); | |
console_log($post_meta); | |
the_meta(); | |
//thông tin về trang hiện tại có lưu ở biến sau | |
global $post_type, $pagenow, $template; | |
//lấy 1 số thông tin về trang hiện tại đang show | |
$screen = get_current_screen(); | |
print_r($screen); | |
/** | |
* log các info khác của wordpress | |
*/ | |
var_dump($GLOBALS['wp']); | |
var_dump($wp->request); | |
console_log(array_keys($GLOBALS)); | |
console_log($GLOBALS['wp_post_types']); | |
var_dump(get_queried_object()); //log đối tượng được query | |
wp_list_pages(); //code liệt kê tất cả các trang con của site | |
wp_list_categories(array()); //list tất cả categories | |
var_dump(get_taxonomies()); //list tất cả taxonomies | |
//code liệt kê tất cả các kích thước ảnh sẽ được tự sinh ra khi up ảnh | |
get_intermediate_image_sizes(); | |
/** | |
* cách lấy info của acf | |
*/ | |
var_dump(get_field_object('row_banner')); //code lấy 1 custom field | |
var_dump(get_field_objects()); //code lấy tất cả custome field liên quan đến 1 post | |
var_dump(array_keys(get_field_objects())); //lấy tất cả key trong 1 array | |
var_dump(array_keys($row_gia_tri_khac_biet)); | |
var_dump(get_fields('options')); //list tất cả acf custome field từ option | |
/** | |
* liệt kê tất cả các action đã đăng ký | |
*/ | |
function get_all_action() { | |
global $wp_filter; | |
echo ''; | |
print_r($wp_filter); | |
echo ''; | |
} | |
/** | |
* cách lấy post ID dựa vào url | |
*/ | |
$url = "http://localhost/beta_ssf/thap-tai-chinh/"; | |
var_dump(url_to_postid( $url )); | |
/** | |
* cách lấy template của trang đang sử dụng | |
*/ | |
//khi người dùng gắn template cho trang, sử dụng các hàm | |
is_page_template(); | |
get_page_template_slug(); | |
// khi người dùng chưa gắn template cho trang, sử dụng hàm custom | |
function get_current_template() { | |
global $template; | |
return substr( $template, strrpos( $template, '/' ) + 1 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* các query các page sử dụng chung 1 file template | |
*/ | |
$args = array( | |
'post_type' => 'page', | |
'post_status' => 'publish', | |
'posts_per_page' => 1, | |
'meta_query' => array( | |
array( | |
'key' => '_wp_page_template', | |
'value' => 'archive-cau-hoi-thuong-gap.php', // file template | |
) | |
) | |
); | |
$loop = new WP_Query($args); | |
if ($loop->have_posts()) : | |
while ($loop->have_posts()) : | |
$loop->the_post(); | |
$title = get_the_title(); | |
endwhile; | |
endif; | |
wp_reset_query(); | |
/** | |
* cách query các term của 1 taxonomy | |
*/ | |
$taxo_terms = get_terms( array( | |
'taxonomy' => 'chuyen-muc-cau-hoi', | |
'hide_empty' => true, | |
'orderby' => 'meta_value_num', | |
'order'=> 'ASC', | |
'meta_key' => 'stt', | |
) ); | |
if(!empty($taxo_terms)) : | |
foreach ($taxo_terms as $term) : | |
$term_id = $term->term_id; | |
$stt = get_field('stt','term_'.$term_id); //ví dụ về cách lấy acf trong term | |
$edit_term = array( | |
'base_link' => get_edit_term_link($term_id, 'chuyen-muc-cau-hoi'), | |
'title' => 'term '.$term->name, | |
); | |
endforeach; | |
endif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* code remove auto generate image size | |
*/ | |
function remove_extra_image_sizes() { | |
//hàm này ko remove được các cỡ default | |
foreach ( get_intermediate_image_sizes() as $size ) { | |
if ( !in_array( $size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) { | |
remove_image_size( $size ); | |
} | |
} | |
} | |
add_action('init', 'remove_extra_image_sizes'); | |
function prefix_remove_default_images( $sizes ) { | |
// Remove default image sizes here. | |
unset( $sizes['small']); // 150px | |
unset( $sizes['medium']); // 300px | |
unset( $sizes['large']); // 1024px | |
unset( $sizes['medium_large']); // 768px | |
return $sizes; | |
} | |
add_filter( 'intermediate_image_sizes_advanced', 'prefix_remove_default_images' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Tạo link đến phần admin sửa nội dung, chỉ hiển thị khi user login inspect code | |
*/ | |
function manh_edit_link_for_text($arg = array( | |
'tail_link' => '', | |
'base_link' => '', | |
'title' => '', | |
)) | |
{ | |
// tạo link đến trang edit chỉ có admin đã login mới nhìn thấy | |
if (!current_user_can('administrator')) { | |
// tạo link đến trang edit chỉ có admin đã login mới nhìn thấy | |
return; | |
} | |
if (gettype($arg) == 'string') { | |
// backward compatibility. trang cũ người dùng truyền tail link | |
$arg2['tail_link'] = $arg; | |
$arg2['base_link'] = ''; | |
$arg = $arg2; | |
} | |
if (empty($arg['base_link']) && empty($arg['tail_link'])) { | |
//nếu người dùng ko truyền tham số | |
$arg['base_link'] = get_edit_post_link(); | |
} | |
if (empty($arg['base_link'])) { | |
$arg['base_link'] = get_site_url(); | |
} | |
if (empty($arg['title'])) $arg['title'] = get_the_title(); | |
$link = $arg['base_link'].$arg['tail_link']; | |
echo '<a hidden style="display:none !important;" href="'.$link.'">'.__('Edit This').' '.$arg['title'].'</a>'; | |
echo '<!-- admin sửa '. $arg['title'].' -->'; | |
} | |
//sau đó sử dụng | |
$edit = array( | |
'base_link' => get_edit_post_link(), | |
'title' => get_the_title(), | |
); | |
if (function_exists('manh_edit_link_for_text')) manh_edit_link_for_text($edit); | |
/** | |
* chỉ cho user đã login mới có thể xem page. Còn lại redirect về trang comming soon | |
*/ | |
function redirect_comming_soon() { | |
if (!current_user_can('administrator')) { | |
wp_redirect(home_url().'/comming-soon/'); | |
exit(); | |
} | |
// global $post; | |
// $post_slug = $post->post_name; | |
// var_dump($post_slug); | |
// var_dump('manhtq'); | |
}; | |
add_action('template_redirect', 'redirect_comming_soon'); | |
/** | |
* khởi tạo và destroy session | |
*/ | |
add_action('init', 'myStartSession', 1); | |
function myStartSession() { | |
if(!session_id()) { | |
session_start(); | |
} | |
} | |
add_action('wp_logout', 'myEndSession'); | |
add_action('wp_login', 'myEndSession'); | |
function myEndSession() { | |
session_destroy (); | |
} | |
/** | |
* cách show error ở admin notice | |
*/ | |
add_action( 'admin_notices', 'my_error_message' ); | |
function my_error_message() { | |
if ( array_key_exists( 'error_duplicate_ma_so_can_ho_message', $_SESSION ) ) { | |
?> | |
<div class="error"> | |
<p> | |
<?php echo $_SESSION['error_duplicate_ma_so_can_ho_message']; ?> | |
<?php //var_dump ($_SESSION); ?> | |
Mã số căn hộ bị trùng với bài | |
<a href="<?php echo get_edit_post_link($_SESSION['error_duplicate_ma_so_can_ho_id_can_ho_duplicate']) ?>"> | |
này. Click vào để chỉnh sửa | |
</a> | |
</p> | |
</div><?php | |
unset( $_SESSION['error_duplicate_ma_so_can_ho_message'] ); | |
unset( $_SESSION['error_duplicate_ma_so_can_ho_id_can_ho_duplicate'] ); | |
} | |
} | |
/** | |
* get $url, $target from acf custom field link | |
* | |
* @param [type] $link | |
* @return array | |
*/ | |
function get_url_target ($link) { | |
if (is_array($link)) { | |
$url = $link['url']; | |
$target = $link['target']; | |
} else { | |
$url = ''; | |
$target = ''; | |
if (!empty($link)) { | |
$url = $link; | |
} | |
} | |
return array($url, $target); | |
} | |
/** | |
* chỉ cho user đã login mới có thể xem page. Còn lại redirect về trang comming soon | |
*/ | |
function redirect_comming_soon() { | |
if (current_user_can('administrator')) { | |
$is_validate = true; | |
} | |
if (!$is_validate) { | |
$is_validate = isset($_SERVER['PHP_AUTH_PW']) && (trim($_SERVER['PHP_AUTH_PW']) == 'kss6688#'); | |
} | |
if (!$is_validate) { | |
header('WWW-Authenticate: Basic realm="My Realm"'); | |
header('HTTP/1.0 401 Unauthorized'); | |
echo 'Text to send if user hits Cancel button'; | |
exit; | |
} | |
if (!$is_validate) { | |
//wp_redirect(home_url().'/comming-soon/'); | |
exit(); | |
} | |
// global $post; | |
// $post_slug = $post->post_name; | |
// var_dump($post_slug); | |
// var_dump('manhtq'); | |
}; | |
add_action('template_redirect', 'redirect_comming_soon'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment