Skip to content

Instantly share code, notes, and snippets.

View apermo's full-sized avatar

Christoph Daum apermo

View GitHub Profile
<?php
/**
* A class to create custom tables within WordPress.
*
* @see https://gist.github.com/apermo/0fb0cbca1f57625ba6753ef3b7f73ffa
*
* @version 1.0.1
*/
namespace apermo\WPTools;
<?php
add_filter( 'heartbeat_settings', 'filter_heartbeat', 10, 1 );
/**
* Filter the heartbeat interval based on the current request.
*
* Called on the 'heartbeat_settings' filter.
*
* @param array $settings The Heartbeat settings. By Default an empty array.
*
<?php
/**
* This is a snippet if your WordPress plugin uses composer autoloading.
*
* Instead of just dying, it will fail gracefully and add an admin notice to the backend,
* informing the dev to run the autoloader.
*
* Could also be adjusted to check for other things like a /build/ folder or similar things.
*
@apermo
apermo / anonymize_users.php
Created April 20, 2025 17:30
Anonymizing WordPress Database
<?php
/**
* Plugin Name: User Migration CLI Command (MU)
* Author: Christoph Daum
* Author URL: https://christoph-daum.com
* Description: Adds a WP-CLI command 'migrate' to anonymize user data, reset passwords, and update meta.
*
* Version: 1.0
* License: GPL2
*/
@apermo
apermo / english
Created July 10, 2025 11:08
Custom Word Sets for https://skribbl.io/ - Pop-culture, Nerd-culture, music, IT etc
Keyboard
Mouse
Screen
Laptop
Server
Cloud
Database
Programmer
Code
Bug
@apermo
apermo / test-smtp.php
Created September 5, 2025 08:27
Simple Script to run and debug tests for smtp mail on WordPress
<?php
/**
* This is used to test and debug the Bedrock Environment Mailer
* https://github.com/hackur/bedrock-env-mailer
*
* Code is derived from it.
* License: MIT
*/
@apermo
apermo / process_images.py
Created April 14, 2026 07:37
Small python script for renaming photos for release for WordCamps
#!/usr/bin/env python3
"""
Enrich all JPEG images with GPS location data and rename them
in chronological order.
GPS coordinates: 48.21718766749917, 16.35311927435226 (Vienna)
Usage:
pip install piexif Pillow
python3 process_images.py # dry run (default)
@apermo
apermo / mu-maintenance-lockdown.php
Last active July 31, 2026 13:02
MU Plugin: signs all users out at a set time, warns beforehand with a JS countdown, and restricts logins to chosen user IDs, roles or super admins for the maintenance window
<?php
/**
* Timed Maintenance Lockdown.
*
* Plugin Name: Timed Maintenance Lockdown
* Description: Locks everyone out of a site at a set time, warns beforehand with a live countdown, and restricts
* logins to chosen user IDs, roles or super admins until the maintenance window closes.
* Version: 1.0.0
* Author: Christoph Daum
* Requires PHP: 8.3