Skip to content

Instantly share code, notes, and snippets.

View jkohlbach's full-sized avatar

Josh Kohlbach jkohlbach

View GitHub Profile
@jkohlbach
jkohlbach / mute-textdomain-errors.php
Created May 15, 2025 00:47
Mute _load_textdomain_just_in_time errors mu-plugin
<?php
/**
* Plugin Name: Mute Textdomain Errors
* Plugin URI: https://rymera.com.au
* Description: Mutes textdomain loading errors and logs them for debugging
* Version: 1.0.0
* Author: Rymera Web Co
* Author URI: https://rymera.com.au
* Text Domain: mute-textdomain-errors
*/
@jkohlbach
jkohlbach / wp-plugin-scaffold-ai-prompt.txt
Last active May 2, 2025 08:07
Single AI Prompt To Scaffold A New WordPress Plugin
You are a senior software engineer/architect specializing in WordPress and WooCommerce.
In this project, implement that basic structure of a new plugin ready for further development
using the following details:
The plugin will be called [your plugin name here]
It is a plugin that [brief description of your new plugin here]
WordPress Plugin Project Structure
==================================
@jkohlbach
jkohlbach / gist:5fae46aa5ec859a9a4ea783e54ce8702
Created January 24, 2025 04:53
No translation disable pre_load_textdomain speed hack
/**
* If we don't have translation, disable pre_load_textdomain to speed up the site.
*/
add_filter( 'pre_load_textdomain', '__return_false' );
@jkohlbach
jkohlbach / gist:7331462
Created November 6, 2013 05:38
Automatically apply a coupon to a user's first order in WooCommerce
add_action('woocommerce_before_cart', 'firstTimeShopper');
add_action('woocommerce_before_checkout_form', 'firstTimeShopper');
function firstTimeShopper() {
global $woocommerce;
$coupon_code = 'firstimeshopper'; // Change this to whatever your coupon code is
if (is_user_logged_in()) {
$current_user = wp_get_current_user();