Skip to content

Instantly share code, notes, and snippets.

@stingray82
Forked from thefrosty/freemius.php
Created November 30, 2024 21:10
Show Gist options
  • Select an option

  • Save stingray82/bdd1a97de50636e6eed47863c7a06cf7 to your computer and use it in GitHub Desktop.

Select an option

Save stingray82/bdd1a97de50636e6eed47863c7a06cf7 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