Skip to content

Instantly share code, notes, and snippets.

<?php
declare(strict_types=1);
/**
* Plugin Name: MU Plugin Loader
* Plugin URI: https://orbital.co.uk
* Description: Safely loads essential plugins as must-use plugins with proper error handling and logging.
* Author: Adam Cullen
* Version: 2.0.0
@addzycullen
addzycullen / acf-menu-fields-conditional.php
Created July 23, 2025 00:59
ACF Menu Fields Conditional Display System - Standalone WordPress functions for conditionally showing ACF fields on menu items based on their depth level.
<?php
/**
* ACF Menu Fields Conditional Display System
*
* Standalone WordPress functions for conditionally showing ACF fields
* on menu items based on their depth level.
*
* Features:
* - Single configuration array controls everything
* - PHP server-side filtering
@addzycullen
addzycullen / WordPress Debug Log | Enable Log
Last active March 10, 2023 12:34
Enable the WordPress Debug log, and hide errors from displaying on site. To be placed in wp_config file below DB prefix
define( 'WP_DEBUG', true );
if ( WP_DEBUG ) {
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'SCRIPT_DEBUG', true );
define( 'SAVEQUERIES', true );
}
@addzycullen
addzycullen / WordPress Debug Log | Write to Log
Last active June 25, 2025 23:02
This fn allows you write to the WordPress debug log if you have it enabled in the wp_config file.
if (!function_exists('write_log')) {
/**
* Write to Debug Log with Optional Context
*
* Logs the provided variable to the PHP error log, always prefixed with the file and line number.
* Optionally includes function, class, and call type context if $show_context is true.
*
* @param mixed $log The content to log (string, array, object, etc).
* @param bool $show_context Whether to include function, class, and type context. Default false.
* @return void
@addzycullen
addzycullen / PHP | Format UK telephone numbers for href
Last active June 10, 2019 13:51
Telephone Number Format for href - Adapted from another source, unfortunately I don't recall where, let me know if you have seen this anywhere so I can credit.
/*
$original = '+44 (0)1234 567 890';
$original = '0044 01234 567 890';
$original = '01234 567 890';
$original = '44 1234 567 890';
Result should always be: +441234567890
*/
// Strip out all characters apart from numbers