Skip to content

Instantly share code, notes, and snippets.

@BronsonQuick
BronsonQuick / gist:62589e4ea2b273e985a0
Created March 22, 2016 07:10
Better backtracing to fix dodgy themes and plugins. Pop this into mu-plugins
<?php
function sennza_backtrace() {
echo implode( '<br>', explode( ',', wp_debug_backtrace_summary( null, 4 ) ) );
};
add_action( 'deprecated_function_run', 'sennza_backtrace' );
add_action( 'deprecated_argument_run', 'sennza_backtrace' );
add_action( 'doing_it_wrong_run', 'sennza_backtrace' );
# Activate the wordpress importer
wp plugin activate wordpress-importer --url=http://localhost/example.com/
# Iterate over all of the import files in a given folder.
for f in myfolder/*.xml; do wp import $f --authors=skip --skip=attachment --url=localhost/example.com/; done
@BronsonQuick
BronsonQuick / no_index.php
Last active January 15, 2016 05:24
Don't index WP sites with staging in the URL.
<?php
/*
Plugin Name: United Influencers Stop Indexing On Staging
Plugin URI: https://hmn.md/
Description: This plugin prevents search engines from indexing our staging sites.
Author: Human Made Limited
Version: 0.1
Author URI: https://hmn.md/
*/
@BronsonQuick
BronsonQuick / facts.pp
Created January 3, 2016 09:29
View all the puppet variables on this client
class all_facts_file {
file { '/tmp/facts.yaml':
content => inline_template('<%= scope.to_hash.reject { |k,v| !( k.is_a?(String) && v.is_a?(String) ) }.to_yaml %>'),
}
}
@BronsonQuick
BronsonQuick / gist:c71a6e46761044231d77
Created November 22, 2015 23:44
Remove known hosts key SSH
ssh-keygen -R hostname
@BronsonQuick
BronsonQuick / otto-wordpress
Created October 3, 2015 19:30
otto-wordpress
bronsonquick@Zero:/Volumes/Sites $ git clone git@github.com:WordPress/WordPress.git ottowordpress
Cloning into 'ottowordpress'...
remote: Counting objects: 219711, done.
remote: Compressing objects: 100% (524/524), done.
remote: Total 219711 (delta 343), reused 0 (delta 0), pack-reused 219187
Receiving objects: 100% (219711/219711), 138.54 MiB | 1.35 MiB/s, done.
Resolving deltas: 100% (173810/173810), done.
Checking connectivity... done.
bronsonquick@Zero:/Volumes/Sites $ cd ottowordpress/
bronsonquick@Zero:/Volumes/Sites/ottowordpress (master) $ otto compile
@BronsonQuick
BronsonQuick / wordcamp_brisbane_jetpack_SCSS.scss
Created June 5, 2015 06:19
WordCamp Brisbane JetPack SCSS for Pascal
/*
Welcome to Custom CSS!
CSS (Cascading Style Sheets) is a kind of code that tells the browser how
to render a web page. You may delete these comments and get started with
your customizations.
By default, your stylesheet will be loaded after the theme stylesheets,
which means that your rules can take precedence and override the theme CSS
rules. Just write here what you want to change, you don't need to copy all
@BronsonQuick
BronsonQuick / gist:5185918001f4df5c5d15
Last active December 19, 2018 20:07
Delete ActionScheduler comments and scheduled-action post types in WooCommerce
wp comment list --field=comment_ID --'post_author'='ActionScheduler' --number=1000 | xargs wp comment delete --force
wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 | xargs wp post delete --force
wp post list --field=ID --post_type=scheduled-action --posts_per_page=1000 --post_status=trash | xargs wp post delete --force
@BronsonQuick
BronsonQuick / gist:8fc49236e57d94abf7cc
Created May 4, 2015 06:03
Delete 1000 WCCommerce Completed orders at a time via WP-CLI
wp post list --field=ID --post_type=shop_order --post_status='wc-completed' --posts_per_page=1000 | xargs wp post delete --force
wp post list --field=ID --post_type=product | xargs wp post delete --force