Skip to content

Instantly share code, notes, and snippets.

@nathaningram
nathaningram / README.md
Created July 24, 2026 12:38
Fix for Solid Security / Kadence Security on Rocket.net: setup wizard and settings saves fail with 'No route was found matching the URL and request method'. MU plugin that de-batches REST /batch/v1 calls to work around a Rocket.net edge bug that strips the method and body of batch requests.

Fix: Solid Security / Kadence Security won't set up or save settings on Rocket.net

Symptom: On WordPress sites hosted at Rocket.net, the Solid Security (formerly iThemes Security, now Kadence Security) setup wizard fails with errors like "Could not save user groups: No route was found matching the URL and request method", and saving any Solid Security settings page fails with "No route was found matching the URL and request method." Settings never stick. Rolling back the plugin and importing a settings export don't help.

Cause: This is not a plugin bug. Rocket.net's edge (CDN layer) mangles any POST to WordPress core's REST batch endpoint (/wp-json/batch/v1) that carries a non-empty requests array: the request's method is changed and its body is stripped before it reaches WordPress, so WordPress answers 404 rest_no_route. Solid Security saves its wizard results and settings-page changes through that batch endpoint, so every save fails. The same request executed server-side (bypassing t

@nathaningram
nathaningram / never-use-this-functions.php
Last active June 1, 2026 18:03
Beyond the Chatbot demo: an intentionally messy WordPress functions.php to practice letting an AI analyze, comment, and clean it up. Do NOT use in production.
<?php
add_filter( 'the_generator', '__return_empty_string' );
remove_action( 'wp_head', 'wp_generator' );
function disable_admin_bar_frontend() {
if ( ! current_user_can( 'administrator' ) && ! is_admin() ) {
show_admin_bar( false );
@nathaningram
nathaningram / bww-pmp-payment-updates.php
Last active May 28, 2026 13:38
PMPro + Stripe: trigger immediate open-invoice retry when a member updates their payment method after a failed renewal
<?php
/**
* Plugin Name: BWW PMPro Payment Updates
* Description: After a member updates their billing in PMPro, immediately tell Stripe to pay the open invoice using the new default payment method instead of waiting for Smart Retries. Falls back to Smart Retries on any error.
* Version: 2026.05
* Author: Brilliant Web Works
*/
add_action( 'pmpro_after_update_billing', 'bww_pmpro_retry_open_invoice_on_billing_update', 10, 2 );
@nathaningram
nathaningram / woo-pin-tg-uc-fix.php
Created March 31, 2026 17:55
WooCommerce Pinterest Pixel Fix for Termageddon / Usercentrics Cookie Consent Tool
// Fix: Pinterest for WooCommerce pixel + UserCentrics consent
//
// The plugin outputs the Pinterest base code via echo in wp_footer — there's
// no filter to modify it. This snippet uses output buffering to intercept the
// full page HTML and replace the script type/attributes so UserCentrics can
// manage consent for the Pinterest pixel.
//
// What it does: changes <script type="text/javascript"> to
// <script type="text/plain" data-usercentrics="Pinterest"> inside the
// Pinterest Pixel Base Code block only. This targets both the standard and
@nathaningram
nathaningram / 2025-mu-dashwidgets.php
Last active May 28, 2026 16:52
Starter Site 2025 - MU Dashboard Widgets
<?php
/*
Plugin Name: Custom Dashboard Widgets
Plugin URI: https://wpnathan.com
Description: Creates Custom Dashboard Widgets for Client Websites
Version: 1.0
Author: Nathan Ingram
Author URI: https://wpnathan.com
License: GPL2
*/
@nathaningram
nathaningram / 2025-mu-gravity.php
Created December 1, 2025 20:44
Starter Site 2025 - MU Gravity Forms
<?php
/*
Plugin Name: Custom Functions for Gravity Forms
Plugin URI: https://wpnathan.com
Description: Customize Gravity Forms Default Behavior
Version: 1.0
Author: Nathan Ingram
Author URI: https://wpnathan.com
License: GPL2
*/
@nathaningram
nathaningram / 2025-mu-beaver.php
Last active December 1, 2025 20:49
Starter Site 2025 - MU Beaver Builder
<?php
/*
Plugin Name: Custom Functions for Beaver Builder
Plugin URI: https://wpnathan.com
Description: Extend and Customize Beaver Builder
Version: 1.0
Author: Nathan Ingram
Author URI: https://wpnathan.com
License: GPL2
*/
@nathaningram
nathaningram / 2025-mu-media.php
Last active December 16, 2025 18:34
Starter Site 2025 - MU Media
<?php
/*
Plugin Name: Custom Media Handling Functions
Plugin URI: https://wpnathan.com
Description: Customize WordPress Default Media Behavior
Version: 1.0
Author: Nathan Ingram
Author URI: https://wpnathan.com
License: GPL2
*/
@nathaningram
nathaningram / 2025-mu-shortcodes.php
Last active December 15, 2025 18:09
Starter Site 2025 - MU Shortcodes
<?php
/*
Plugin Name: Custom Shortcodes
Description: Add Custom Shortcodes
Plugin URI: https://wpnathan.com
Version: 1.0
Author: Nathan Ingram
Author URI: https://wpnathan.com
License: GPL2
*/
@nathaningram
nathaningram / 2025-mu-security.php
Last active December 1, 2025 20:48
Starter Site 2025 - MU Security
<?php
/*
Plugin Name: Custom Security Functions
Description: Customized WP Security
Version: 1.0
Plugin URI: https://wpnathan.com
Author: Nathan Ingram
Author URI: https://wpnathan.com
License: GPL2
*/