Skip to content

Instantly share code, notes, and snippets.

View afragen's full-sized avatar

Andy Fragen afragen

View GitHub Profile
<?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

@afragen
afragen / .wp-env.json
Created May 24, 2023 19:26
Just an example, doesn't work for core development.
{
"core": "WordPress/wordpress-develop#trunk",
"phpVersion": "8.1",
"plugins": [
"https://downloads.wordpress.org/plugin/query-monitor.zip"
],
"port": 8888,
"testsPort": 8889,
"config": {
"WP_DEBUG": true,
@afragen
afragen / phpcs.xml
Last active September 10, 2023 16:55
phpcs files for my plugins and core plugins
<?xml version="1.0"?>
<ruleset name="AJF Coding Standards">
<description>A custom ruleset to take in account both WordPress and personal standards.</description>
<!-- Show progress and sniff codes in all reports -->
<arg value="ps"/>
<arg value="sp"/>
<arg name="colors"/>
<!-- Only check PHP files. -->
@afragen
afragen / karma.php
Last active July 17, 2025 17:40
Impose karma on specific users
<?php
/**
* Karma.
*
* @package Fragen\Karma
*
* Plugin Name: Karma
* Plugin URI: https://gist.github.com/afragen/b45511007d0a1c07ad285ce6e223a91c
* Description: Impose karma on users.
* Version: 0.9.0
@afragen
afragen / git-updater-fastspring-popup.php
Created November 3, 2022 23:34
Add javascript for FastSpring's Git Updater popup store.
<?php
/**
* Add FastSpring popup store script for Git Updater.
*
* @package FastSpringPopUpStore
*
* Plugin Name: FastSpring Popup Store for Git Updater
* Plugin URI: https://gist.github.com/afragen/e7819dd1e17be5792c299dbef989d446
* Description: Add FastSpring popup store javascript for Git Updater.
* Version: 0.1.0
@afragen
afragen / php.ini.hbs
Last active January 11, 2023 22:29
Stuff for xDebug 3.x and Local
; Add to all lightning services PHP conf files using xDebug 3.x
xdebug.mode=debug
xdebug.client_port=9003
xdebug.start_with_request=trigger
xdebug.discover_client_host=yes
xdebug.idekey=VSCODE
; Add to all lightning services PHP conf files using xDebug 2.x
xdebug.remote_enable=1
xdebug.remote_connect_back=Off