Blocking wp-login.php brute forcing
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.
Install fail2ban using apt
# apt install fail2ban
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
/* | |
* | |
* 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 |
<?php | |
if ( is_singular('YOUR_CUSTOM_POST_TYPE') ) { | |
$terms = get_the_terms($post->ID, 'custom_categories'); | |
foreach ($terms as $term) { | |
$term_link = get_term_link($term, 'custom_categories'); | |
if (is_wp_error($term_link)) | |
continue; | |
echo '<a href="' . $term_link . '">' . $term->name . '</a>, '; | |
} |
## Use the code below only if you had enable .htaccess - "AllowOverride All" | |
## You may need to enable mod_headers on apache - "a2enmod headers" | |
## The code below goes under the rules that you should have if you are using WordPress | |
#BEGIN https code | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
#BEGIN Block bad hackers |
<?php | |
/** | |
* | |
* Usage [workcpt posts_per_page="4" term="4"] . | |
* I'm using MultiPostThumbnails plugin (line 63) to fetch a second fetaure image - if you are not using the plugin please replace that with get get_the_post_thumbnail_url(get_the_ID(),'full'); | |
* Change post_type to your CPT name | |
* Change taxonomy to your taxonomy name | |
* | |
*/ | |
// @codingStandardsIgnoreStart |