Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
<?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 March 21, 2024 12:54
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.
@afragen
afragen / _Docker-wp_xDebug_AppleSilicon.md
Last active December 20, 2023 20:30
My setup for wordpress-develop Docker wp environment on Apple Silicon with xDebug active

These are the files needed for setting up the Docker wp environment for wordpress-develop with xDebug active on Apple Silicon. Currently Docker wp runs

  • PHP 7.4.33
  • xDebug 3.1.6

I created and placed the custom-php-config.ini file one level above wordpress-develop.

The docker-compose.override.yml is at the root level of wordpress-develop.

Then simply follow the instructions in the https://github.com/WordPress/wordpress-develop/blob/trunk/README.md