Skip to content

Instantly share code, notes, and snippets.

Ken Prince kjprince

Block or report user

Report or block kjprince

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mikaelz / delete-all-woocommerce-products.php
Last active Jan 22, 2020
Remove all WooCommerce products from database via SQL
View delete-all-woocommerce-products.php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");
eriteric / movegfjstofooter.php
Last active Dec 27, 2019
Load gravity forms JS in footer
View movegfjstofooter.php
// GF method:
add_filter( 'gform_init_scripts_footer', '__return_true' );
// solution to move remaining JS from
add_filter( 'gform_cdata_open', 'wrap_gform_cdata_open' );
function wrap_gform_cdata_open( $content = '' ) {
$content = 'document.addEventListener( "DOMContentLoaded", function() { ';
return $content;
add_filter( 'gform_cdata_close', 'wrap_gform_cdata_close' );
simonvreeman / Google Analytics Content Experiments code for Google Tag Manager
Last active Mar 6, 2017
With this script you are good to go for client-site A/B/n testing with Content Experiments. Add ?var=1 to preview the variation of the A/B test.
View Google Analytics Content Experiments code for Google Tag Manager
<script src="//"></script>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(;
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
var varID = getParameterByName('var');
if(! varID){ var chosenVariation = cxApi.chooseVariation(); }
# (not really -- run these commands by hand & pay attention to the comments)
# Homebrew: The missing package manager for OS X
ruby -e "$(curl -fsSL"
# Git
brew install git
git config --global --add merge.ff false
markjaquith / nginx.conf
Last active Jul 14, 2019
My WordPress Nginx setup
View nginx.conf
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
BronsonQuick / add_tinymce_custom_classes_with_backwards_compatibility.php
Last active Aug 29, 2015
Add TinyMCE custom classes to WordPress with backwards compatibility
View add_tinymce_custom_classes_with_backwards_compatibility.php
Sometimes we want to give clients access to additional styles in TinyMCE. These functions also handle backwards compatibility with WordPress as TinyMCE 3 and TinyMCE 4 handle this differently
function sennza_mce_buttons( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
add_filter( 'mce_buttons_2', 'sennza_mce_buttons' );
function sennza_mce_before_init( $init_array ) {
adamcapriola / page_discourse-sso.php
Last active Dec 10, 2018
WordPress Page Template for SSO with Discourse
View page_discourse-sso.php
* Template Name: Discourse SSO
* Author: Adam Capriola
* Version: 1.1
* Author URI:
* Adapted From:
* Uses:
ddebernardy / WP-SubdirInstall-Fixes.php
Last active Oct 21, 2016
SubdirInstall component for WordPress
View WP-SubdirInstall-Fixes.php
namespace Mesoconcepts\WordPress\Plugin\BugFixes\Component;
use Mesoconcepts\WordPress\Bridge\Component\WordPressInterface;
use Mesoconcepts\WordPress\Bridge\DependencyInjection\EagerLoadedInterface;
use Mesoconcepts\WordPress\Bridge\DependencyInjection\EventSubscriberInterface;
* Subdir install fixes -- part of MIT-licensed `mesoconcepts/mc-bug-fixes` plugin
View static-templates.php
* Plugin Name: Static Templates
* If most of your site content is in .php template files, and you're tired of
* creating new pages, assigning them page templates, creating page templates
* then doing it all over again on production, this plugin is for you.
* Examples:
You can’t perform that action at this time.