Skip to content

Instantly share code, notes, and snippets.

View rafflepress-invent-your-own.php
Plugin Name: RafflePress Invent Your Own
Plugin URI:
Description: Programmatically Add User and Complete Actions in RafflePress
Author URI:
License URI:
nerdcha /
Last active Apr 2, 2020
Bash oneliner to delete tweets
# Context:
twurl "/1.1/statuses/user_timeline.json?screen_name=YOUR_TWITTER_HANDLE&count=200&max_id=$(twurl '/1.1/statuses/user_timeline.json?screen_name=YOUR_TWITTER_HANDLE&count=200&include_rts=1' | jq -r '.[9]|.id_str')&include_rts=1" | jq -r '.[]|.id_str' | parallel -j 10 -a - twurl -X POST /1.1/statuses/destroy/{1}.json > /dev/null
View Fortress.Options.php
* Encryption operations for working with WordPress options to store data
* in the options table. Not all options will be encrypted. You will need
* to wire up selection of options to be protected separately.
* @package Fortress
namespace DisplaceTech\Fortress\Options;
jchristopher / functions.php
Last active Aug 15, 2019
Prevent EDD Software Licensing Recurring renewal when associated subscription is failing
View functions.php
// Prevent license renewal when associated subscription is failing
// (it will cause double charges and double subscriptions and waste a lot of your time)
add_action( 'edd_pre_add_to_cart', function( $download_id, $options ) {
// Only applicable if this is a renewal.
if ( empty( $options['is_renewal'] ) ) {
davekiss / gist:2639184ac066c53416b23c5a66f42d1e
Created Feb 2, 2019
EDD Weekly Domain Report via Email
View gist:2639184ac066c53416b23c5a66f42d1e
* Add a weekly email report that summarizes which domains that
* your products are being used on.
add_filter( 'cron_schedules', function( $schedules ) {
$schedules['weekly'] = array(
'interval' => 604800,
'display' => __('Once Weekly')
View functions.php
// Quick and dirty *AUTOMATIC* upgrade-only discount for EDD (no discount code)
class SearchwpUpgradeDiscount {
private $upgrade_discount = 30; // 30% discount
private $applicable = false;
function __construct() {
add_filter( 'edd_get_cart_content_details_item_discount_amount', function( $discount, $item ) {
brianhogg / gist:b87c216dde537ecaccdc5063858d0c3f
Last active Oct 30, 2018 — forked from davekiss/gist:e2b5beb37b3a1a93a3dddcf43ce51ce9
Display notice in EDD if email already exists and not logged in
View gist:b87c216dde537ecaccdc5063858d0c3f
Plugin Name: EDD Prompt Login On Checkout
Plugin URI:
Description: Prompt login if email exists
Author: Dave Kiss
Version: 1.0.0
Author URI:
License: GPL2
davekiss / gist:e2b5beb37b3a1a93a3dddcf43ce51ce9
Created Sep 18, 2018
Display notice in EDD if email already exists and not logged in
View gist:e2b5beb37b3a1a93a3dddcf43ce51ce9
* Redirect the user to the appropriate page upon login.
add_filter( 'login_redirect', function( $url, $query, $user ) {
if ( is_wp_error( $user ) ) {
return $url;
if ( current_user_can('administrator') ) {
return $url;
ianmjones /
Last active Feb 27, 2021
A script for downloading the AWS PHP SDK v2, stripping down to S3 functionality and then applying a custom namespace.
#!/usr/bin/env bash
set -e
if [ ! -d src/amazon-s3-and-cloudfront ]; then
echo 'This script must be run from the repository root.'
exit 1
for PROG in composer find sed
bradyvercher / register-plugin-icons.php
Created Oct 4, 2017
Register icons to display on the Manage Plugins screen for plugins that aren't in the directory.
View register-plugin-icons.php
* Register plugin icons.
* WordPress 4.9 introduced icons in the list table on the Manage Plugins
* screen. The icons are pulled from the update API. If an icon isn't
* available, a generic plugin Dashicon is shown instead.
* @param array $value Plugin update data.
* @return array