Created
January 12, 2024 17:39
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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