Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
@afragen
afragen / trick-auto-update.php
Created August 24, 2022 20:03
Allows one to mash the WP Crontrol 'Run now' link with abandon.
/**
* Trick `WP_Automatic_Updater` into thinking there is no existing lock.
*
* By default, the auto-updater will only run once every hour even if
* the cron job is manually fired. That makes it hard to run multiple tests
* in a short period of time.
*/
add_filter(
'option_auto_updater.lock',
function ($value) {
<?php
/**
* Auto-update fatal error check test plugin.
*
* @package AutoUpdateFatalErrorCheck
*
* Plugin Name: Auto-update Fatal Error Check Test Plugin
* Plugin URI: https://github.com/afragen/fatal-plugin
* Description: Set local version to 0 and comment code from plugin for testing.
* Version: 0.1.1
@afragen
afragen / auto-update-fatal-error-check.php
Last active August 3, 2022 17:55
Run the Rollback code if the plugin has an activation error.
<?php
/**
* Auto-update fatal error check.
*
* @package AutoUpdateFatalErrorCheck
*
* Plugin Name: Auto-update Fatal Error Check
* Plugin URI: https://gist.github.com/afragen/518819349528dba930cf7845180d5274
* Description: Check for a PHP error on plugin auto-update and deactivate plugin if one exists.
* Version: 0.4.2
@afragen
afragen / gist-oembed.php
Last active August 5, 2022 19:56
WordPress plugin to embed gists or gist files.
<?php
/**
* Gist oEmbed.
*
* @package Fragen\Gist_OEmbed
*
* Plugin Name: Gist oEmbed
* Plugin URI: https://gist.github.com/afragen/36ab01da116aadd27a3f4d85cce90390
* Description: oEmbed Gist or files within Gists.
* Version: 0.6.2
@afragen
afragen / stop-auto-update-success-email.php
Last active July 15, 2025 18:22
Stop success update email for plugin/theme auto updates.
<?php
/**
* Stop success email from auto-updates.
*
* @package StopAutoUpdateSuccessEmail
*
* Plugin Name: Stop Auto-update Success Email
* Plugin URI: https://gist.github.com/afragen/e2f40ed2e71e590a127e8adc1db05948
* Description: Stop success email from auto-updates.
* Version: 0.6.0
@afragen
afragen / auto-flush-object-cache.php
Last active December 26, 2025 16:38
Catches 'PHP Fatal error Allowed memory size of xxxxxxx bytes exhausted' and 'RedisException' debug.log messages and flushes object cache.
<?php
/**
* Auto-flush object cache.
*
* @package Fragen\Auto_Flush_Cache
*
* Plugin Name: Auto-Flush Object Cache
* Plugin URI: https://gist.github.com/afragen/d46d3cc2c7e07d99f921560dfbb70246
* Description: Auto-flush the object cache when error log records PHP Fatal error for allowed memory size.
* Version: 0.8.1
@afragen
afragen / instructions.md
Last active April 14, 2022 18:27
Change LocalWP wp-config.php for WP-CLI
@afragen
afragen / docker-compose-edits
Last active April 3, 2022 19:14
Add this file to root of wordpress-develop on Apple Silicon to pull correct mysql container.
# Add support for linux/amd64 mysql into docker-compose.yml
services:
mysql:
platform: linux/amd64 <--
<?php
/**
* Plugin Name: GlotPress for Git Updater
* Plugin URI: https://gist.github.com/afragen/4574e1ce54a621351e5eb18ac686f8f3
* Description: This plugin is used for site testing.
* Version: 0.3.0
* Author: Andy Fragen
* License: MIT
* Requires at least: 5.9
* Requires PHP: 7.4
<?php
/**
* Plugin Name: Count Filter Calls
* Plugin URI: https://gist.github.com/afragen/a8a89888c60c4836a21667531469c7a9
* Description: Count number of times certain filters are called and cumulative time spent for the call with almost no computing done.
* Version: 0.3
* Author: Andy Fragen
* License: MIT
* Requires at least: 5.2
* Requires PHP: 7.0