Skip to content

Instantly share code, notes, and snippets.

danielbitzer / file.php
Last active Sep 14, 2022
AutomateWoo - Action function to change subscription next payment date
View file.php
* AutomateWoo action function to extend a subscription by 3 months.
* A note will be added to the subscription.
* Ensures that the dates near the end of the month are logically handled and do not shift to the start of the following month.
* Custom action function docs:
GhazanfarMir /
Last active Sep 26, 2022
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
nerandell /
Last active Sep 19, 2022
PHP Code Review Guidelines

Make sure these boxes are checked before submitting/approving the PR


  • The code works
  • The code is easy to understand
  • Follows coding conventions
  • Names are simple and if possible short
  • Names are spelt correctly
  • Names contain units where applicable
  • There are no usages of magic numbers
carlodaniele / kinsta-share-users.php
Last active May 19, 2022
A plugin to share users and usermeta tables between independent WordPress installations. This plugin requires CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE defined into wp-config file
View kinsta-share-users.php
* @package Kinsta_Share_Users
* @version 1.0
Plugin Name: Kinsta Share Users
Plugin URI:
Description: This is an example plugin for Kinsta blog readers
Author: Carlo Daniele
helgatheviking / kia_convert_country_code.php
Created Dec 7, 2015
Converts the WooCommerce country codes to 3-letter ISO codes
View kia_convert_country_code.php
* Converts the WooCommerce country codes to 3-letter ISO codes
* @param string WooCommerce's 2 letter country code
* @return string ISO 3-letter country code
function kia_convert_country_code( $country ) {
$countries = array(
'AF' => 'AFG', //Afghanistan
wpscholar / create-admin-user.php
Last active Mar 29, 2022
Create a new admin user in WordPress via code. Drop this file in the mu-plugins directory and update the variables, then load a page in WordPress to create the user. Remove the file when done.
View create-admin-user.php
add_action( 'init', function () {
$username = 'admin';
$password = 'password';
$email_address = '';
if ( ! username_exists( $username ) ) {
$user_id = wp_create_user( $username, $password, $email_address );
danielbachhuber / gist:c1554c1777dbb0460bfb
Created May 12, 2014
Serve a subset of terms at /term-slug instead of /tag/term-slug
View gist:c1554c1777dbb0460bfb
* 'special-term' is a unique butterfly
function dbx_get_special_terms() {
return array( 'special-term' );
BFTrick / woocommerce-only-ship-continental-us.php
Last active Aug 10, 2020
WooCommerce only ship to the continental US.
View woocommerce-only-ship-continental-us.php
* Plugin Name: WooCommerce Only Ship to Continental US
* Plugin URI:
* Description: Only Ship to the Continental US
* Author: Patrick Rauland
* Author URI:
* Version: 1.0.1
* This program is free software: you can redistribute it and/or modify
woogist / gist:6267983
Created Aug 19, 2013
WooCommerce - Display checkout custom field on the order edition page
View gist:6267983
* Display field value on the order edition page
add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );
function my_custom_checkout_field_display_admin_order_meta($order){
echo '<p><strong>'.__('My Field').':</strong> ' . $order->order_custom_fields['My Field'][0] . '</p>';