Skip to content

Instantly share code, notes, and snippets.

View solaceten's full-sized avatar

Solace solaceten

View GitHub Profile
@solaceten
solaceten / Block Bad Bots in CSF and Modsec
Last active March 25, 2024 04:46
Block those bad bots in CSF and Mod Sec
# Block Bad Bots in CSF and MOD SEC - easy
# 1) install CSF and Mod Sec
# 2) Set up the mod sec rules - instructions here (note these are for Direct admin, they will likely work on other systems too)
# https://www.vpsbasics.com/security/how-to-block-bad-bots-using-modsecurity-with-directadmin/
# 3) get bad bots list from Ultimate Bad Bot
# 3.1) Go Here: https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/tree/master/_generator_lists
# 3.2) Open the latest bad-user-agents-htaccess.list and view the "raw"
# 3.3) copy to your bad-botlist.txt file
# 4) install - then restart csf and ldf and watch your logs...
# hint: if you set LF_MODSEC in the csf firewall ( e.g. set it as LF_MODSEC = 5 and LF_MODSEC_PERM = 86400 (which is 24hrs) then CSF will add persistent offenders to the block list....
<?php
// function to access node <package> which is above <hotel>
// https://www.wpallimport.com/documentation/code-snippets/#access-data-above-element-chosen-on-step-2
function wpai_pmxi_before_xml_import( $importID ) {
// output all activity to a debug log, so we can see where script is failing
defined('PDD_DEBUG') or define('PDD_DEBUG', 1); // set to 1 for ON
defined('PDD_LOG_FILE') or define('PDD_LOG_FILE', WP_CONTENT_DIR . '/errors-pdd.log');
@solaceten
solaceten / remove-woocommerce-submenu-items
Last active October 20, 2021 00:03 — forked from WillBrubaker/remove-woocommerce-submenu-items
Remove WooCommerce submenu items for Shop Managers
/*
Removes submenu items from WooCommerce menu for 'Shop Managers'
available submenu slugs are:
wc-addons - the Add-ons submenu
wc-status - the System Status submenu
wc-reports - the Reports submenu
edit.php?post_type=shop_order - the Orders submenu
edit.php?post_type=shop_coupon - the Coupons submenu
Shop Managers lack the capability of 'update_core', so remove based on that capability