Skip to content

Instantly share code, notes, and snippets.

View WProbot's full-sized avatar
💭
I may be slow to respond.

Lukács József WProbot

💭
I may be slow to respond.
View GitHub Profile
@WProbot
WProbot / clinup
Created November 28, 2021 06:00 — forked from petskratt/clinup
Use wp-cli to clean up WordPress installs (force core & plugins reinstall, track changes in git allowing easy reverts etc)
#!/usr/bin/env bash
# for debug output, uncomment:
#set -x
function help {
echo "WordPress cleanup -v 0.5 2018-06-26 / peeter@zone.ee
Usage:
@WProbot
WProbot / cc-wc-orders-controller
Last active November 25, 2021 03:56 — forked from LosArtos/cc-wc-orders-controller
orders-controller
<?php
if (!defined('ABSPATH')) {
exit;
}
class CC_WC_Orders_Controller
{
public function Init()
{
@WProbot
WProbot / import-optimizations.md
Created April 20, 2021 20:14 — forked from trey8611/import-optimizations.md
WP All Import - Optimize your import speed.
@WProbot
WProbot / functions.php
Created March 17, 2021 04:59
Allow resending new order emails in WooCommerce
add_filter('woocommerce_new_order_email_allows_resend', '__return_true' );
@WProbot
WProbot / functions.php
Created March 17, 2021 04:58 — forked from lukecav/functions.php
Gutenberg Block Manager disable all WooCommerce blocks
add_filter( 'gbm_disabled_blocks', function() {
return ['woocommerce/active-filters', 'woocommerce/all-products', 'woocommerce/all-reviews', 'woocommerce/product-best-sellers', 'woocommerce/featured-category', 'woocommerce/featured-product', 'woocommerce/attribute-filter', 'woocommerce/price-filter', 'woocommerce/handpicked-products', 'woocommerce/product-new', 'woocommerce/product-on-sale', 'woocommerce/product-categories', 'woocommerce/product-search', 'woocommerce/products-by-attribute', 'woocommerce/product-category', 'woocommerce/product-tag', 'woocommerce/reviews-by-category', 'woocommerce/reviews-by-product', 'woocommerce/product-top-rated', 'woocommerce/product-button', 'woocommerce/product-sale-badge', 'woocommerce/product-image', 'woocommerce/product-price', 'woocommerce/product-rating', 'woocommerce/product-summary', 'woocommerce/product-title']
});
@WProbot
WProbot / wp-email-log.php
Created March 10, 2021 13:52 — forked from Rarst/wp-email-log.php
A simple mu–plugin snippet for overriding and logging WP emails in development.
<?php
class R_Mailer {
function Send() {
error_log( wp_debug_backtrace_summary() );
}
}
add_action( 'phpmailer_init', function( &$mailer ) {
$mailer = new R_Mailer();
@WProbot
WProbot / return_mirror_sender.php
Created March 10, 2021 13:38 — forked from butlerblog/return_mirror_sender.php
Set the mail return path to mirror the sender in wp_mail to reduce likelihood of spam rejection
add_action( 'phpmailer_init', 'fix_my_email_return_path' );
function fix_my_email_return_path( $phpmailer ) {
$phpmailer->Sender = $phpmailer->From;
}
@WProbot
WProbot / filter_wp_mail_to_addr.php
Created March 10, 2021 13:36 — forked from butlerblog/filter_wp_mail_to_addr.php
Change the wp_mail() "to" address based on subject
<?php
/**
* This is a filter for wp_mail(). It checks the subject
* for the presence of a given string (in this case "New
* User Registration"), and if that returns true it
* sets the "to" address/value.
*/
add_filter( 'wp_mail', 'my_wp_mail_filter' );
function my_wp_mail_filter( $args ) {
@WProbot
WProbot / wp_mail_bcc.php
Created March 10, 2021 13:34 — forked from butlerblog/wp_mail_bcc.php
wp_mail() add bcc based on contents of subject line
<?php // DO NOT include this line. Add below to your theme functions.php
/**
* Add bcc address to email based on contents
* of the email subject line.
*
* Set email address and content of the subject
* line for the email being filtered.
*/
add_filter( 'wp_mail', 'custom_mails' );
@WProbot
WProbot / wp_config.php
Created March 10, 2021 13:32 — forked from butlerblog/wp_config.php
Configure WordPress wp_mail function to send through SMTP server https://b.utler.co/Y3
<?php
/*
* Set the following constants in wp-config.php.
* These should be added somewhere BEFORE the constant ABSPATH is defined.
*
* Author: Chad Butler
* Author URI: https://butlerblog.com
*
* For more information and instructions, see: https://b.utler.co/Y3