Skip to content

Instantly share code, notes, and snippets.

View haze83's full-sized avatar

Marcel Imper haze83

View GitHub Profile
@haze83
haze83 / f4t_wc_hooks.php
Last active June 10, 2026 10:39
F4 Simple Checkout Fields for WooCommerce
<?php
/**
* Add fields to formatted addresses
*
* @since 4.10.0
* @access public
* @static
*
* @param string $address_html The address HTML.
/* select skuld_cont_inst with wrong language */
SELECT p.ID ci_id,
p.post_parent ci_parent,
p.post_type ci_post_type,
tt.term_taxonomy_id ci_tt_id,
t.slug ci_lang,
p_p.*
FROM wp_posts AS p
INNER JOIN wp_term_relationships AS tr
-- https://decodeunicode.org/en/u+2028
SELECT *
FROM wp_postmeta
WHERE post_id = 3646;
SELECT *
FROM wp_postmeta
WHERE post_id IN (
@haze83
haze83 / wp-cli-search-replace.sh
Last active September 11, 2024 22:57
WP Search Replace domain
wp db search <string_to_find> --stats
wp search-replace old.domain.ch new.domain.ch --recurse-objects --all-tables --skip-plugins --skip-themes
@haze83
haze83 / .aliases
Last active February 12, 2024 10:31
Install Hosting
alias l='ls -l'
alias la='ls -la'
alias lt='ls --tree'
alias ll="ls -lhAF"
alias wp="wp-cli"
alias myip="curl http://ipecho.net/plain; echo"
@haze83
haze83 / F4BackgroundRequest.php
Last active November 3, 2023 22:40
WP Background Process
<?php
/**
* F4 Background Process
*
* Based on WP_Background_Process
* https://github.com/A5hleyRich/wp-background-processing/blob/master/classes/wp-background-process.php
*/
if ( ! class_exists( 'F4_Background_Process' ) ) {
<?php
static::add_action('wp_ajax_validate_email_domain', 'validate_email_domain');
static::add_action('wp_ajax_nopriv_validate_email_domain', 'validate_email_domain');
public static function validate_email_domain() {
// check_ajax_referer( 'validate_email_domain_nonce' );
Theme::var_dump([
'request' => $_REQUEST
]); die();
@haze83
haze83 / f4t_wc_email_cc_shipping.php
Last active June 10, 2026 10:39
F4 Shipping Phone and E-Mail for WooCommerce
<?
/**
* Adds shipping email address as cc to WoocCmmerce customer emails
*
* @param string $header WC_Email header
* @param string $id WC_Email id
* @param \WC_Order $object
* @return string
*
@haze83
haze83 / create-config.sh
Last active October 20, 2025 12:43
WP-CLI
#!/bin/bash
# bash -c "$(curl -s https://gist.githubusercontent.com/haze83/0a8c65479b793285e00e92f561e66f8d/raw/d2537e8e3db767a9eb0954446e6bde571f107dc1/create-config.sh)"
echo "WP user: "
read WP_USER
echo "PROD (no leading /, relative to $HOME): "
read WP_PATH_PROD
echo "STAGING (no leading /, relative to $HOME): "
read WP_PATH_STAGING