Skip to content

Instantly share code, notes, and snippets.


Matty Cohen mattyza

View GitHub Profile
View phpcs.xml
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards">
<description>WooCommerce extension PHP_CodeSniffer ruleset.</description>
<!-- Exclude paths -->

Simple iDoneThis Alternative

This simple script is for logging all of the awesome things you do every day, using Terminal, and syncing them all to Dropbox. Nifty, right?


  • Grab the file to a directory on your computer (tested with OS X).
  • Using Terminal, in the directory where you placed, run the following commands:
  • mv /usr/local/bin/
mattyza / customer-centric-from-details.php
Created Mar 10, 2016
Use the customer's details as the "From" information for "New Order" emails in WooCommerce.
View customer-centric-from-details.php
function custom_use_customer_from_address ( $from_email, $obj ) {
if ( is_a( $obj, 'WC_Email_New_Order' ) ) {
$address_details = $obj->object->get_address( 'billing' );
if ( isset( $address_details['email'] ) && '' != $address_details['email'] ) {
$from_email = $address_details['email'];
return $from_email;
add_filter( 'woocommerce_email_from_address', 'custom_use_customer_from_address', null, 2 );
mattyza / matty-double-post-type-rewrite-rule-example.php
Last active Jul 17, 2020
A WordPress custom rewrite rule example, combining two post types.
View matty-double-post-type-rewrite-rule-example.php
* Plugin Name: Double Post Type Rewrite Rule Example
* Plugin URI:
* Description: Adds a custom rewrite rule to mimic
* Author: Matty Cohen
* Author URI:
* Version: 1.0.0
* Stable tag: 1.0.0
* License: GPL v3 -
mattyza / matty-profile-rewrite.php
Created Aug 22, 2012
Modify the "/author" rewrite rule in WordPress to read "/profile" (permalinks refresh required).
View matty-profile-rewrite.php
* Plugin Name: Add "/profile" URL rewrite rule.
* Version: 1.0.0
* Author: Matty
* Description: Add a rewrite rule to redirect "/profile" URLs to the appropriate author archive screen.
new Matty_Profile_Rewrite();
You can’t perform that action at this time.