Skip to content

Instantly share code, notes, and snippets.

@invisnet
Created April 7, 2021 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invisnet/b533f12c59f61682fa5a0db9155e1dbe to your computer and use it in GitHub Desktop.
Save invisnet/b533f12c59f61682fa5a0db9155e1dbe to your computer and use it in GitHub Desktop.
Shared mu-plugins Freemius Path Fixer
<?php
/*
* Plugin Name: Shared mu-plugins Freemius Path Fixer
* Plugin URI: https://gist.github.com/invisnet/b533f12c59f61682fa5a0db9155e1dbe
* Description: Fix the Freemius WordPress SDK asset paths when hosting with shared mu-plugins directory.
* Version: 0.9.0
* Author: Charles Lecklider
* Author URI: https://invis.net/
* License: GPLv2
*/
/**
* Override the Freemius functions in `fs-core-functions.php`
*/
function fs_enqueue_local_style($handle, $path, $deps = array(), $ver = false, $media = 'all')
{
wp_enqueue_style($handle, '/wp-content/mu-plugins/wordpress-sdk/assets/css/'.trim($path, '/'), $deps, $ver, $media);
}
function fs_enqueue_local_script($handle, $path, $deps = array(), $ver = false, $in_footer = 'all')
{
wp_enqueue_script($handle, '/wp-content/mu-plugins/wordpress-sdk/assets/js/'.trim($path, '/'), $deps, $ver, $in_footer);
}
function fs_img_url($path, $img_dir = WP_FS__DIR_IMG)
{
return '/wp-content/mu-plugins/wordpress-sdk/assets/img/'.trim($path, '/');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment