Skip to content

Instantly share code, notes, and snippets.

@thefrosty
Created January 12, 2024 17:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save thefrosty/d9bb001c05a407ba1aaa60c8b75aeb43 to your computer and use it in GitHub Desktop.
Create an override function, as to bypass Freemius in some less than smart plugins.
<?php
declare(strict_types=1);
/**
* Create an override function, as to bypass Freemius in stupid plugins.
* @wordpress-muplugin
* Plugin Name: Freemius Killer
* Description: Global override for Freemius' "loader".
* Version: 1.0.0
* Author: Austin Passy
* Author URI: https://github.com/thefrosty
* phpcs:disable
*/
if (!\is_blog_installed()) {
return;
}
// Create the Freemius Stub in case other plugins use their own global we need to override.
$freemius_stub = new class {
public function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1)
{
return;
}
};
/**
* Find your plugins' Freemius global variable and assign it below.
* This example is using Menu Image; $mi_fs found in `wp-content/plugins/menu-image/menu-image.php:147`
*/
global $mi_fs;
$mi_fs = $freemius_stub;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment