This guide will tell you how to setup a custom fail2ban filter and jail to watch the Apache access log and ban malicious attackers who brute for wp-login.php.
# apt install fail2ban
#!/bin/bash | |
# ------------------------------------------------- | |
# Make site directory | |
# Download WP and install WP to site directory | |
# Set WP configuration | |
# Configure NGINX for new domain-name | |
# ------------------------------------------------- | |
# | |
# Requirments: | |
# |
function ns_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]); | |
} | |
} | |
} |
<div class="posts-listings"> | |
<?php | |
$args = array( | |
'posts_per_page' => '1', | |
'orderby' => 'featured-checkbox', | |
'order' => 'ASC', | |
'meta_query' => array( | |
array( |
<?php | |
//send a welcome email when a user account is activated | |
add_action( 'bp_core_activated_user', 'yz_welcome_user_notification', 10, 3 ); | |
function yz_welcome_user_notification( $user_id, $key = false, $user = false ) { | |
if ( is_multisite() ) { | |
return ;// we don't need it for multisite | |
} | |
//send the welcome mail to user |
/* | |
* | |
* Allows contributors to see and manage only their custom post types and drafts from the manage posts screen. | |
* src: https://wordpress.stackexchange.com/questions/89233/restrict-contributors-to-view-only-their-own-custom-post-types | |
* | |
*/ | |
add_action( 'pre_get_posts', 'aet_filter_cpt_listing_by_author' ); | |
function aet_filter_cpt_listing_by_author( $wp_query_obj ){ | |
// Front end, do nothing | |
if( !is_admin() ) |
add_filter( 'wp_nav_menu_objects', 'ns_add_menu_parent_class' ); | |
function ns_add_menu_parent_class( $items ) { | |
$parents = array(); | |
foreach ( $items as $item ) { | |
//Check if the item is a parent item | |
if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) { | |
$parents[] = $item->menu_item_parent; | |
} | |
} |
/* | |
* Menu | |
* add class to <a> on WP menu | |
*/ | |
function ns_menu_add_class( $atts, $item, $args ) { | |
if($args->theme_location == 'topics') { | |
$class = 'term--single with-image'; // or something based on $item | |
$atts['class'] = $class; | |
} |
#!/bin/bash | |
# This file is designed to spin up a Wireguard VPN quickly and easily, | |
# including configuring a recursive local DNS server using Unbound | |
# | |
# Make sure to change the public/private keys before running the script | |
# Also change the IPs, IP ranges, and listening port if desired | |
# iptables-persistent currently requires user input | |
# add wireguard repo | |
sudo add-apt-repository ppa:wireguard/wireguard -y |