Skip to content

Instantly share code, notes, and snippets.

View ksolomon's full-sized avatar

Keith Solomon ksolomon

View GitHub Profile
@ksolomon
ksolomon / README-Template.md
Created December 21, 2022 13:00 — forked from DomPizzie/README-Template.md
A simple README.md template

Project Title

Simple overview of use/purpose.

Description

An in-depth paragraph about your project and overview of use.

Getting Started

@ksolomon
ksolomon / wpfuncs.php
Last active October 8, 2019 12:29
Collection of WordPress helper functions I use constantly.
<?php
// addFirstLastClass() - Add first and last classes to list items returned from wp_list_pages.
function addFirstLastClass($pageList) {
// pattern to focus on just li's
$allLisPattern = '/<li class="page_item(.*)<\/li>/s';
preg_match($allLisPattern,$pageList,$allLis);
$liClassPattern = "/<li[^>]+class=\"([^\"]+)/i";
// first let's break out each li
$liArray = explode("\n",$allLis[0]);
@ksolomon
ksolomon / xmlrpc-brute-protection.php
Created October 9, 2015 17:41
Block XMLRPC Brute Force Amplification Attacks on WordPress
<?php
/*
Plugin Name: XML-RPC Brute Protection
Description: Disable XML-RPC methods used in brute-force amplification attacks
Author: Keith Solomon
Version: 1.0
License: GPL2
*/
function mmx_remove_xmlrpc_methods($methods) {