Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
@afragen
afragen / glotpress-mods.php
Last active August 24, 2024 15:40
Simple plugin to fix some PHP8 errors in GlotPress
<?php
/**
* GlotPress Modifications.
*
* Plugin Name: GlotPress Modifications
* Plugin URI: https://gist.github.com/afragen/acf808925400dc8a0544fd9611ff2189
* Description: Modifications to GlotPress to fix PHP 8 errors.
* Version: 0.3.0
* Author: Andy Fragen
* License: MIT
<?php
/**
* Plugin Name: WP-CLI: Force Auto-Updates
* Description: Forces auto-updates. `wp autoupdates force`
* Author: WordPress Core Contributors
* Author URI: https://make.wordpress.org/core
* License: GPLv2 or later
* Gist Plugin URI: https://gist.github.com/afragen/86ab7b2e9edac70697ecb0e7c5c49056
* Version: 1.0.0
@afragen
afragen / mu-loader.php
Last active May 30, 2024 18:05
A generic mu-plugins loader for plugins stored in wp-content/plugins folder.
<?php
/**
* MU Loader
*
* @author Andy Fragen, Colin Stewart
* @license MIT
* @package mu-plugins
*/
/**
@afragen
afragen / log-user-ip.php
Last active February 2, 2024 17:22
Log user IP to debug.log on login.
<?php
/**
* Log User IP.
*
* @package Fragen\Log_User_IP
*
* Plugin Name: Log User IP
* Plugin URI: https://gist.github.com/afragen/dda81b07997c5cc1d58fd90396adeb0a
* Description: Log user IP to debug.log at login.
* Version: 0.1.0
@afragen
afragen / fast-updates.php
Created October 19, 2023 21:55
A modified plugin from Peter Wilson for testing auto-updates
<?php
/**
* Plugin Name: Schedule Update Events NOW(ish)!
* Description: Schedules auto-updates every 60 seconds (if not already running). If they don't start, refresh. You can run the long command if impatient. But don't be impatient 😉
*/
namespace PWCC\FastUpdates;
// return;
<?php
/**
* Plugin Name: RAU Edge Case 2 - Defining Function in main plugin file.
* Description: Defining class in main plugin file.
* Version: 0.1.0
* Author: Andy Fragen
* License: MIT
* Requires at least: 6.2
* Requires PHP: 7.1
* Gist Plugin URI: https://gist.github.com/afragen/5366d3c9be9ba95b26545ca7105a9474
<?php
/**
* Plugin Name: RAU Edge Case - Defining Function in main plugin file.
* Description: Defining class in main plugin file.
* Version: 0.1.0
* Author: Andy Fragen
* License: MIT
* Requires at least: 6.2
* Requires PHP: 7.1
* Gist Plugin URI: https://gist.github.com/afragen/775d9627e4578ba286817a5dceb92807
<?php
/**
* Plugin Name: RAU Edge Case - Defining Class in main plugin file.
* Description: Defining class in main plugin file.
* Version: 0.1.0
* Author: Andy Fragen
* License: MIT
* Requires at least: 6.2
* Requires PHP: 7.1
* Gist Plugin URI: https://gist.github.com/afragen/efd22a5bcd527374a7843dec24463f47
<?php
/**
* Plugin Name: RAU Edge Case - Defining Constants in main plugin file.
* Description: Defining Constants in main plugin file.
* Version: 0.1.0
* Author: Andy Fragen
* License: MIT
* Requires at least: 6.2
* Requires PHP: 7.1
* Gist Plugin URI: https://gist.github.com/afragen/89cb21b5de301b28e65ceb56d264659a
@afragen
afragen / remove_hook.php
Last active September 4, 2023 20:34
Kludge for removing hook in WordPress when you don't have the exact callback object.
<?php
/**
* Kludge to remove hooks when I can't pass the precise object instance.
*
* @param string $hook_name The filter hook to which the function to be removed is hooked.
* @param callable|string|array $callback The callback to be removed from running when the filter is applied.
* This method can be called unconditionally to speculatively remove
* a callback that may or may not exist.
* @param int $priority The exact priority used when adding the original filter callback.