Skip to content

Instantly share code, notes, and snippets.

@stingray82
stingray82 / admin__wp-reset.php
Created December 28, 2025 20:26
Devkit - Alternative delete_plugins() - This allows additional protected plugins using a filter
public function delete_plugins() {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
require_once ABSPATH . 'wp-admin/includes/file.php';
// Plugin basenames you NEVER want to delete
$protected = array(
DPDEV_BASE, // devkit itself
);
// Let other code add more protected plugins
@stingray82
stingray82 / Fix.php
Created December 2, 2025 23:21
Updated Requests for dplugin updater hotfix
// Add this to the main file
// Disable requests only for devkit/devkit.php.
//add_filter( 'devkit_dpupdatechecker_enable_request_devkit_devkit_php', '__return_false' );
//Then update inc/update.php with this
public function request() {
// 0) Allow disabling / short-circuiting the request via filters.
// Global toggle for all plugins using this updater.
@stingray82
stingray82 / snippet.php
Created December 2, 2025 23:08
Hoster Filter Suggestion
Add Filter to Requests simlar to:
public function request() {
// 1) Global toggle for all plugins using hoster updater
$enabled = apply_filters(
'devkit_dpupdatechecker_enable_request',
true,
$this->slug,
$this
@stingray82
stingray82 / updater.php
Created December 2, 2025 22:57
Hoster Updater.php - Set Transient on error
public function request() {
$remote = get_transient( $this->cache_key );
// If we have any cached value (success OR failure) take note.
if ( false !== $remote ) {
if ( ! is_array( $remote ) ) {
$decoded = json_decode( $remote );
if ( json_last_error() === JSON_ERROR_NONE ) {
$remote = $decoded;
}
@stingray82
stingray82 / Snippet.php
Created October 26, 2025 21:28
MainWP Icon's Testing
<?php
add_filter('mainwp_before_save_cached_icons', function ($cached_icons, $icon, $slug, $type, $custom_icon, $noexp) {
// Use the SAME raw links as before
$map_urls = [
'plugin' => 'https://raw.githubusercontent.com/stingray82/mainwp-plugin-icons/main/icons-map.json',
'theme' => 'https://raw.githubusercontent.com/stingray82/mainwp-plugin-icons/main/themes-icons-map.json',
];
@stingray82
stingray82 / Snippet.php
Last active September 15, 2025 21:48
Intercept and Modify outgoing mail to hotmail
<?php
//Snippet
add_filter('wp_mail', function ($args) {
$domains_to_override = ['hotmail.com', 'outlook.com', 'live.com', 'msn.com']; // add/remove as needed
$new_from_email = 'no-reply@yourdomain.com';
$new_from_name = 'Your Site';
// Normalize "to" into an array
$recipients = is_array($args['to'])
? $args['to']
@stingray82
stingray82 / snippet.php
Created July 10, 2025 17:13
Example - Custom Rest API End Point - FluentCRM
<?php
// Register the REST API route
add_action('rest_api_init', function () {
register_rest_route('custom-fluentcrm-api/v1', '/add-note', [
'methods' => 'POST',
'callback' => 'handle_custom_fluentcrm_add_note',
'permission_callback' => function () {
return current_user_can('edit_users'); // Adjust capability if needed
},
'args' => [
@stingray82
stingray82 / TaperMonky
Created May 7, 2025 22:06
WPCODEbox IDE - Front End / Backend Icon
// ==UserScript==
// @name Open WPCodeBoxIDE Frontend with Overlay
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Click floating icon on WP Admin or front-end to open WPCodeBoxIDE frontend.php
// @match *://*/*
// @grant GM_openInTab
// @grant GM_registerMenuCommand
// @run-at document-idle
// ==/UserScript==
@stingray82
stingray82 / post-access-expiry-scheduler
Created May 2, 2025 22:40
SureCart Post Access Manager - Post Expiry Scheduler - Helper Plugin
<?php
/**
* Plugin Name: Post Access Expiry Scheduler
* Description: Separately schedules and handles expiry of post access granted by the main Post Access Manager plugin, with enable/disable toggle and debug logging, linked to the main plugin
* Version: 1.0.0
* Author: Reallyusefulplugins.com
* Text Domain: rup-pamsc-access-expiry
*/
if ( ! defined( 'ABSPATH' ) ) {