Skip to content

Instantly share code, notes, and snippets.

@tbartels
tbartels / keybase.md
Created October 6, 2017 12:56
keybase.md

Keybase proof

I hereby claim:

  • I am tbartels on github.
  • I am thomfellow (https://keybase.io/thomfellow) on keybase.
  • I have a public key ASCusBi6F7tk4AOwaPs8h3iPRr6QwJ6ORYjm05WxXCFqbwo

To claim this, I am signing this object:

@tbartels
tbartels / fix-ga4wp-slashes.php
Created November 21, 2013 12:32
Adjust google-analytics-for-wordpress by Yoast to clean up magic quotes and allow for a custom script that correctly writes Javascript so alternate tracking codes will validate.
<?php
/**
Plugin Name: Google Analytics for Wordpress Slashes Fix
Description: Strip slashes on the GAforWP plugin by Yoast to correctly avoid excess/infinite magic quotes.
Version: 0.1.0
Author: Thomas Bartels &lt;<a href="mailto:tbartels@gmail.com">tbartels@gmail.com</a>&gt;
This plugin fixes the options for Yoast's 'google-analytics-for-wordpress' plugin
allowing for more complex content to be used in the form fields. Specifically it
will now be possible to put Javascript in the `gajsurl` field in order to use the
@tbartels
tbartels / gist:4045376
Created November 9, 2012 12:04 — forked from mattboon/gist:4045215
Update WP user_login via SQL
<?php
// Force update our username (user_login)
global $wpdb;
// method 1
#$sql = $wpdb->prepare("UPDATE {$wpdb->users} SET user_login = %s WHERE ID = %d", $user_email, $user_id);
#$wpdb->query($sql);
// method 2
$wpdb->update($wpdb->users, array('user_login' => $user_email), array('ID' => $user_id));