Skip to content

Instantly share code, notes, and snippets.

View jbrinley's full-sized avatar

Jonathan Brinley jbrinley

View GitHub Profile
<?php
require_once( 'wp-includes/class-wp-hook.php' );
require_once( 'wp-includes/class-wp-hook-iterator.php' );
function _wp_filter_build_unique_id($tag, $function, $priority) {
global $wp_filter;
static $filter_id_count = 0;
if ( is_string($function) )
<?php
function tribe_filter_import_data_before( $post ) {
if ( $post['post_type'] == TribeEvents::POSTTYPE && !empty($post['post_parent']) ) {
$start_date = '';
if ( isset($post['postmeta']) && is_array($post['postmeta']) ) {
foreach ( $post['postmeta'] as $meta ) {
if ( $meta['key'] == '_EventStartDate' ) {
$start_date = $meta['value'];
<?php
/*
Plugin Name: The Events Calendar - Cleanup Recurrence Duplicates
Description: Some users upgrading from an earlier version of Events Calendar PRO may, in rare circumstances, end up with duplicates of recurring events.
Version: 3.5
Author: Modern Tribe, Inc.
Author URI: http://tri.be?ref=tec-plugin
Text Domain: tribe-events-calendar-recurrence-cleanup
License: GPLv2 or later
@jbrinley
jbrinley / gist:10990289
Created April 17, 2014 15:04
Add this to functions.php in your theme to disable the automatic creation of future events.
add_action('init', 'disable_future_event_scheduling', 11, 0);
function disable_future_event_scheduling() {
TribeEventsRecurrenceMeta::get_scheduler()->remove_hooks();
}
@jbrinley
jbrinley / taxonomy.php
Created June 12, 2014 13:05
Add tags to community events submission form. Add this to the end of the modules/taxonomy.php template.
<?php
$tags_string = '';
if ( isset($_POST['tax_input']) && isset($_POST['tax_input']['post_tag']) ) {
$tags_string = $_POST['tax_input']['post_tag'];
} elseif ( get_post() && get_the_ID() ) { // is there a current post?
$current_tags = get_the_terms(get_the_ID(), 'post_tag');
$current_tags = wp_list_pluck( $current_tags, 'name' );
$tags_string = implode(', ', $current_tags);

Keybase proof

I hereby claim:

  • I am jbrinley on github.
  • I am jbrinley (https://keybase.io/jbrinley) on keybase.
  • I have a public key whose fingerprint is C697 B2D2 BE92 218A 8008 BA4B 66AD FFFF 3754 7705

To claim this, I am signing this object:

@jbrinley
jbrinley / gist:eaaad00b52e1316c6904
Created February 18, 2015 20:40
WP Trac 17817 Release Notes

WordPress 4.2 introduces a significant reworking of action and filter iteration to address bugs that arose from recursive callbacks and from callbacks that changed the hooked callbacks on currently running actions/filters.

What does this mean for you, the plugin or theme developer? In almost all cases, nothing. Everything should continue to run as expected, and this should fix a number of hard-to-trace bugs when different plugins are stepping on each others callbacks.

Who is affected?

If your plugin directly accesses the $wp_filter global rather than using the public hooks API, you might run into compatibility issues.

Case 1: Directly setting callbacks in the $wp_filter array

@jbrinley
jbrinley / nginx.conf
Created June 2, 2015 20:49
Partial nginx.conf to show proxy IP forwarding
location / {
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $proxy_remote_addr;
proxy_set_header X-Forwarded-For $proxy_remote_addr;
@jbrinley
jbrinley / mail-to-text.php
Created September 20, 2015 19:21
Send all WP emails to text files in the uploads directory
<?php
/*
Plugin Name: Mail to Text
Description: Sends all WP emails to text files in the uploads directory
*/
if ( !function_exists( 'wp_mail' ) ) :
@jbrinley
jbrinley / object-cache.php
Created September 24, 2015 16:27
A memcached object cache handler for WordPress, based on https://wordpress.org/plugins/memcached-redux/
<?php
/*
Plugin Name: Memcached Redux
Description: The real Memcached (not Memcache) backend for the WP Object Cache.
Version: 0.2
Plugin URI: http://wordpress.org/extend/plugins/memcached/
Author: Scott Taylor - uses code from Ryan Boren, Denis de Bernardy, Matt Martz
Contributors: jbrinley, Modern Tribe
Install this file to wp-content/object-cache.php