Skip to content

Instantly share code, notes, and snippets.

@wycks
wycks / meta-box-snip.php
Created July 3, 2013 20:05
Adds meta box to posts, pages and custom post types (including default ones ..attachment, menu and revisions).
<?php
$post_types= get_post_types('','names');
$posts_separated = implode(",", $post_types);
$screens = array( 'post', 'page', $posts_separated);
foreach ($screens as $screen) {
add_meta_box( 'styles', 'hello', 'callback_func', $screen, 'advanced', 'high');
}
@wycks
wycks / fuckstrap.css
Last active December 17, 2015 06:29
FuckStrap.css - A framework so terse it shits diamonds.
/*Pixel straps start here*/
/*Scroll hard for % straps*/
.0{ width: 0px;}
.1{ width: 1px;}
.2{ width: 2px;}
.3{ width: 3px;}
.4{ width: 4px;}
.5{ width: 5px;}
.6{ width: 6px;}
WordPress block botnet brute force with Mod_security
SecAction phase:1,nolog,pass,initcol:ip=%{REMOTE_ADDR},initcol:user=%{REMOTE_ADDR},id:5000134
<Locationmatch "/wp-login.php">
# Setup brute force detection.
# React if block flag has been set.
SecRule user:bf_block "@gt 0" "deny,status:401,log,id:5000135,msg:'ip address blocked for 5 minutes, more than 10 login attempts in 3 minutes.'"
# Setup Tracking. On a successful login, a 302 redirect is performed, a 200 indicates login failed.
SecRule RESPONSE_STATUS "^302" "phase:5,t:none,nolog,pass,setvar:ip.bf_counter=0,id:5000136"
SecRule RESPONSE_STATUS "^200" "phase:5,chain,t:none,nolog,pass,setvar:ip.bf_counter=+1,deprecatevar:ip.bf_counter=1/180,id:5000137"
@wycks
wycks / Remove-Stuff.php
Last active November 17, 2021 23:45
Remove WordPress Admin Stuff
<?php
/**
* @package WordPress
* @subpackage WP-Skeleton
*/
// REMOVE SOME HEADER OUTPUT
function Wps_remove_header_info() {
remove_action('wp_head', 'rsd_link');
@wycks
wycks / caching-plugins-benchmark.md
Last active December 14, 2015 00:48
Apache bench tests on WordPress

Data

###Test One low concurrency

Complete requests: 100  
Concurrency Level: 5 
HTML transferred: 1805700 bytes 

Slowest to fastest

@wycks
wycks / image_optimize-wordpress.php
Last active December 16, 2020 01:48
Remove WordPress full size images from being inserted into a post + option to and add max size to to prevent users from inserting massive images.
<?php
/**
*
* This removes the ability to add the FULL image size into a post, it does not alter or delete the image
* Add whataever extra image sizes to the insert dropdown in WordPress you create via add_image_size
*
* For now we have to do it this way to make the labels translatable, see trac ref below.
*
* If your theme has $content_width GLOBAL make sure and remove it
<?php
/**
* Plugin Name: (#81791) Dump cURL Request & Response
* Author: Franz Josef Kaiser
*/
add_action( 'plugins_loaded', array( 'WPSE81791_cURL', 'init' ) );
class WPSE81791_cURL
{
protected static $instance;
@wycks
wycks / Monokai-PhpStorm-Base.xml
Last active December 10, 2015 06:08
Monokai theme for PhpStorm that fits closer to the sublime2 soda dark version.
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="Monokai-Custom" version="1" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="16" />
<option name="EDITOR_FONT_NAME" value="Consolas" />
<colors>
<option name="CARET_COLOR" value="f8f8f0" />
<option name="CARET_ROW_COLOR" value="3e3d32" />
<option name="CONSOLE_BACKGROUND_KEY" value="272822" />
<option name="GUTTER_BACKGROUND" value="272822" />
<?php
/*
Plugin Name: Kill Trackbacks
Plugin URI: http://pmg.co/category/wordpress
Description: Kill all trackbacks on WordPress
Version: 1.0
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
*/
@wycks
wycks / gist:4231143
Created December 7, 2012 06:14
The worst wordpress the_content filter ever created
<?php
function phonetic_fools($content){
$pieces = str_split($content);
foreach ($pieces as $piece => $noise) {
$fools = metaphone($noise);
$str = strtolower($fools);