Skip to content

Instantly share code, notes, and snippets.

@kierzniak
kierzniak / functions.php
Created February 28, 2018 10:02
Redirect posts with old permalink structure to new links.
<?php
/**
* Redirect posts with old permalink structure to new links.
*
* If you change your posts permalink structure you should redirect all
* trafic from old permalink to new one. This script will redirect posts
* from /%postname%/ to current post link using 301 status.
*
* This script is working only for /%postname%/ => current link
@igorbenic
igorbenic / coupon_filter.php
Last active November 24, 2021 20:48
How to manage Order Item Data in WooCommerce | https://www.ibenic.com/manage-order-item-meta-woocommerce
<?php
// WC_Checkout
/**
* Add coupon lines to the order.
*
* @param WC_Order $order Order instance.
* @param WC_Cart $cart Cart instance.
*/
@solaceten
solaceten / automatewoo order.billing_email
Last active June 10, 2025 10:27
Create the custom variable "order.billing_email" for use in automate woo
/*
// original snippet URL: https://gist.github.com/solaceten/7f03aed8c3b232742b1f6fb7777d8776
// Author solaceten. You are free to do what you want with this but not sell it or make any money from its use.
//
// Explainer:
// Below is a custom function to add a custom variable into automate woo.
// This example enables the use of a new variable: order.billing_email - as a variable in the workflow ACTION section, email TO field.
// As at Dec 2024, in automatewoo, this variable is working after adding the following code.
//
// While this code allows you to use the new variable {{ order.billing_email }} in your Workflow, note that in the main queue admin table,
@wpeasy
wpeasy / DummyJSON_API.php
Last active October 28, 2025 06:08
Bricks Builder: : Query Loop anything from any API!
<?php
define("WPE_JSON_TRANSIENT_NAME", "wpe_dummyjson");
define("WPE_JSON_TRANSIENT_TTL", 60);
define("WPE_JSON_ENDPOINT_BASE", "https://dummyjson.com/");
/** Add query type to dropdown */
add_filter("bricks/setup/control_options", function ($control_options) {
// Add a new query loop type
$control_options["queryTypes"]["wpe_json"] = esc_html__(
"DummyJSON",