Skip to content

Instantly share code, notes, and snippets.

@kyleconroy
kyleconroy / deauthorize.php
Created January 6, 2015 20:29
Stripe Connect deauthorize account
<?php
$url = "https://connect.stripe.com/oauth/deauthorize";
$data = array(
'client_secret' => "Replace me with your secret API key",
'client_id' => "Replace me with your client_id",
'stripe_user_id' => "Replace me with your stripe_user_id",
);
$body = http_build_query($data);

Preparing Plugins for Term Splitting

Historically, two terms in different taxonomies with the same slug (for instance, a tag and a category sharing the slug "news") have shared a single term ID. Beginning in WordPress 4.2, when one of these shared terms is updated, it will be split: the updated term will be assigned a new term ID.

In the vast majority of situations, this update will be seamless and uneventful. However, some plugins and themes store term IDs in options, post meta, user meta, or elsewhere. WP 4.2 will include two different tools to help authors of these plugins and themes with the transition.

The 'split_shared_term' action

When a shared term is assigned a new term ID, a new 'split_shared_term' action is fired. Plugins and themes that store term IDs should hook to this action to perform necessary migrations. The documentation for the hook is as follows:

@wturnerharris
wturnerharris / w3tc-mu.md
Last active May 21, 2021 18:48
Install procedures to enable W3TC as a WordPress MU (must-use) plugin.

###W3TC MU-Plugins Install

  1. ####Add Apache Rewrite Rule -> .htaccess:

    • RewriteRule ^wp-content/plugins/w3-total-cache(/.*|)$ /wp-content/mu-plugins/w3-total-cache$1 [L,NC]
  2. ####Add WP-Config Option -> wp-config.php:

    • define('W3TC_DIR', dirname(FILE).'/wp-content/mu-plugins/w3-total-cache');
  3. ####Add w3tc plugin -> mu-plugins/:

  • Upload entire plugin to mu-plugins/w3-total-cache/
@strangerstudios
strangerstudios / subsite-lostpassword.php
Created March 11, 2014 14:47
Updates URLs on susbites and in lost password request emails to point to the subsite where the lost password request started.
<?php
/*
Plugin Name: Subsite Lostpassword
Plugin URI: http://www.paidmembershipspro.com/wp/subsite-lostpassword/
Description: Updates URLs on susbites and in lost password request emails to point to the subsite where the lost password request started.
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
@alexstone
alexstone / slack_notification.php
Created March 3, 2014 06:54
Fire a Slack Notification via CURL
<?php
// (string) $message - message to be passed to Slack
// (string) $room - room in which to write the message, too
// (string) $icon - You can set up custom emoji icons to use with each message
public static function slack($message, $room = "engineering", $icon = ":longbox:") {
$room = ($room) ? $room : "engineering";
$data = "payload=" . json_encode(array(
"channel" => "#{$room}",
"text" => $message,
@ranacseruet
ranacseruet / MyS3Client.php
Last active July 28, 2022 19:58
Retrieve Multiple files from Amazon S3
<?php
namespace S3;
use Aws\S3\S3Client;
use \Aws\Common\Exception\TransferException;
/**
* Description of S3Client
* @author Rana
* @link http://codesamplez.com/programming/amazon-s3-get-multiple-objects-php
@Rarst
Rarst / composer.json
Last active January 27, 2023 12:40
Test project for WordPress stack via Composer
{
"name" : "rarst/install-test",
"description" : "Test project for WordPress stack via Composer",
"authors" : [
{
"name" : "Andrey Savchenko",
"homepage": "http://www.Rarst.net/"
}
],
"type" : "project",
@eduardozulian
eduardozulian / wp-customize-image-reloaded.php
Last active November 16, 2023 02:50
Extend WP_Customize_Image_Control class allowing access to files uploaded within the same context.
<?php
/**
* Customize Image Reloaded Class
*
* Extend WP_Customize_Image_Control allowing access to uploads made within
* the same context
*/
class My_Customize_Image_Reloaded_Control extends WP_Customize_Image_Control {
/**
* Constructor.
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@Abban
Abban / WordPress Theme Customizer Sample.php
Created June 21, 2012 21:09
WordPress Theme Customizer Sample
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================