Skip to content

Instantly share code, notes, and snippets.

View MattRyanCo's full-sized avatar

Matt Ryan MattRyanCo

View GitHub Profile
@MattRyanCo
MattRyanCo / disable-auto-update-notices.php
Created September 14, 2023 13:14
Disable auto update notices - add code snippet.
// Dissable core auto update notices if sucessful.
add_filter( 'auto_core_update_send_email', 'capweb_stop_auto_update_emails', 10, 4 );
function capweb_stop_update_emails( $send, $type, $core_update, $result ) {
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
return true;
}
// Dissable theme and plugin auto update notices.
add_filter( 'auto_plugin_update_send_email', '__return_false' );
@MattRyanCo
MattRyanCo / gf-honeypot-enabler.php
Created June 8, 2023 20:35
Plugin to update honeypot on all Gravity Forms on your website.
<?php
/*
Plugin Name: Gravity Forms Honeypot Enabler
Description: Enables the honeypot setting for all Gravity Forms on your website.
Version: 1.0
Author: Your Name
*/
// Hook into WordPress initialization
add_action('init', 'enable_gravity_forms_honeypot');
@MattRyanCo
MattRyanCo / remove-wptexturize-filter.php
Created December 1, 2022 17:10
Remove smart quote filtering on post title via wptexturize
if ( ! function_exists( 'text-domain_remove_title_wptexturize' ) ) {
/**
* Turn off WP default smart quote conversions in post title.
*/
function text-domain_remove_title_wptexturize() {
remove_filter( 'the_title', 'wptexturize' );
}
@MattRyanCo
MattRyanCo / .gitignore
Created October 10, 2022 20:09 — forked from salcode/.gitignore
.gitignore file for a general web project - Bare Minimum Git
# -----------------------------------------------------------------
# .gitignore
# Bare Minimum Git
# https://salferrarello.com/starter-gitignore-file/
# ver 20220720
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/10017553/raw/.gitignore
# to download this file
#
@MattRyanCo
MattRyanCo / b1g150off.php
Created June 14, 2021 15:47
WooCommerce Buy One Get One 50% off through a set date
add_action('woocommerce_cart_calculate_fees', 'add_custom_discount_2nd_at_50', 10, 1 );
function add_custom_discount_2nd_at_50( $wc_cart ){
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;
// Get out of here if we are past the specific date set in the dateDifference function below.
if ( 0 > tew_dateDifferenceEOM( '2021-06-30') ) return;
$discount = 0;
$items_prices = array();
@MattRyanCo
MattRyanCo / sec-scan.sh
Last active September 16, 2018 21:49
shell script to run through all MainWP sites performing security scan
# cd into the root of your MainWP dashboard site
# Note: your wordpress install may be at a different location on your web host
# This example is an apache host where I ssh into the root of the server
cd ../var/www/html
# run wp-cli command to list all your MainWP child sites
wp mainwp sites
# output looks like this (withou the # symbol - that is a comment indicator)
#+----+---------------------------+------------------------+---------+
#| id | name | url | version |
#+----+---------------------------+------------------------+---------+
@MattRyanCo
MattRyanCo / mainwp-scan-all.sh
Created August 28, 2018 11:04
Run MainWP Sucuri Scan of multiple sites from console
# bash shell
#Log into server via bitvise ssh - good multi-line shell handling
cd ../var/www/html
# Get listing of all MainWP sites
wp --allow-root mainwp sites
# Run Sucuri scan on each
for i in 1 3 4 5 7 8 11 13 14 16 17 18; do wp --allow-root mainwp-sucuri scan $i; done
@MattRyanCo
MattRyanCo / git-author-rewrite.sh
Created August 24, 2018 19:52
Replace / rewrite incorrect author email with correct
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Matt Ryan"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@MattRyanCo
MattRyanCo / phpinfo.php
Created July 23, 2018 16:22
phpinfo file to get dump of system vars. Copy to root of website and visit example.com/phpinfo.php. Delete after done.
<?php phpinfo();?>
@MattRyanCo
MattRyanCo / gist:606c47eea7b7f8f8931948e76b402312
Created September 27, 2017 19:51
Add Size Attribute Column to WooCommerce Custom Exporter
// Ref: https://github.com/skyverge/wc-plugins-snippets/blob/master/woocommerce-customer-order-csv-export/add-product-attributes-to-one-row-per-item-order-export.php
/**
* Adds size attribute to the one row per item order export
* CANNOT be used with non-one row per item formats
*/
/**
* Add a 'size' column to the export file
*
* @param array $headers
* @return array