Releases: Freemius/wordpress-sdk
Composer Support, Parallel Free/Premium Activation, Pricing Page Update, and Various Fixes
We are glad to announce v2.10.1 of our WordPress SDK. This version introduces several improvements and bug fixes. Please find the details below.
⚠️ DISCLAIMER: DO NOT CHANGE SDK LOCATION YET
While you'll read that this version brings wp.org compliance and supports SDK from being loaded from vendor
directory, please do not change the SDK location of your existing product yet. We discovered an old bug in our SDK that will most likely cause some error messages to be shown in the automatic update UI.
This issue only affects premium products changing SDK location, not new or free version of the products. While the "error message" does not break anything, it still gives bad UX, hence we ask not to change the location of the SDK yet.
We are already working on a solution, and we will update you as soon as possible. We hugely appreciate your understanding and patience in this regard.
Composer Support and WP.org Compliance
The WordPress.org review team now requires our SDK to be loaded from a directory named vendor
to ensure compliance with repository standards.
Until now, we asked our makers to download and place the SDK inside the root directory of their product and rename the directory to freemius
.
To comply with this requirement, we've updated our SDK to be loaded from the vendor/freemius
directory instead. You can manually copy the SDK into such a directory structure, and it will work seamlessly for both plugins and themes.
Please note that you will also need to update the integration snippet to load the SDK start.php
from the new directory and we recommend "committing" the change so that the reviewer team can see it.
require_once __DIR__ . '/vendor/freemius/start.php';
We also recognize the growing need for Composer-based installations, especially since many modern plugins and themes use this dependency manager. To enhance developer experience (DX), we now officially support Composer.
You can install our SDK with the following command:
composer require freemius/wordpress-sdk
Then, require the Composer autoloader file:
require_once __DIR__ . '/vendor/autoload.php';
Our SDK will work out of the box without any further modifications.
Since this is a compliance request from WordPress.org, we strongly encourage you to make the necessary changes as soon as possible.
Note for symlinked plugins:
If you are symlinking any freemius powered plugin to the
wp-content/plugins
directory, which uses composer auto-loading,
please note that the directory name must match with the original directory. For exampleln -s ../../awesome-plugin ./awesome-plugin
will work, butln -s ../../awesome-plugin ./some-other-name
will not work.
Parallel Activation of Both Free and Premium Versions
Historically, our SDK supported activating either the Free or the Premium version of a WordPress plugin. It also included a mechanism to automatically deactivate the free version when the premium version was activated.
However, some use cases require both free and premium versions to remain active, particularly to collect better statistics from WordPress.org.
Previously, we introduced the deactivate_on_activation
filter to modify this behavior. However, it wasn't a complete solution and could lead to bugs in scenarios like bulk plugin activation or updates on WordPress Multisite networks.
We've now completed this feature by introducing a new initialization code. To use this feature, add the following code to your fs_dynamic_init
call:
$my_fs = fs_dynamic_init( [
// ... existing configuration options.
'parallel_activation' => [
'enabled' => true,
'premium_version_basename' => 'premium-slug/filename.php',
],
] );
With this code, the SDK will:
- Avoid deactivating the free version during premium version activation (unless specifically modified by the
deactivate_on_activation
filter). - Automatically show the license activation page if the free version does not have a license activated.
More information can be found here. If you encounter any issues using this feature, please contact our support team.
Pricing Page Update
The SDK now includes v1.1.0 of the pricing page app. Based on community feedback, we've introduced the following enhancements:
- Added the
pricing/show_annual_in_monthly
filter to control how annual billing cycle pricing is displayed. - Introduced the
plugin_icon
filter to override the image displayed on the page. - Added the
pricing/disable_single_package
filter to control the rendering of single-plan products. - Introduced the
pricing/css_path
filter to add custom CSS to the pricing page.
More details can be found in the README file of the pricing page repository.
Additionally, we've fixed the following issues:
- The "Lifetime" tab was incorrectly displayed in some cases. This has been resolved.
- The "Free" plan was mistakenly rendered with an "Upgrade" button, even when it was the current plan. This has been fixed.
- The current plan was not properly highlighted in some scenarios. This has been corrected.
WordPress Playground support
We’re excited to share that the new SDK version officially supports WordPress Playground! When a playground environment is detected, the SDK will automatically run in anonymous mode, skipping the opt-in process to provide a seamless and engaging demo experience.
But that’s not all! The SDK also detects other popular sandbox/playground platforms, like InstaWP and TasteWP, and enables anonymous mode automatically to streamline the setup process even further.
Other bug fixes and enhancements
- Improved heuristics for cron-based syncing of license and install entities to avoid performance issues, especially on Multisite networks.
- Fixed an edge-case JavaScript issue that caused the license activation dialog to fail in some scenarios.
- Updated staging site URL pattern for Kinsta.
Pricing page 2.0, fullscreen Checkout experience and WordPress.org compliance update
Version 2.9.0 comes with various improvements and updates to provide a better experience for your users and stay compliant with the latest wp.org guidelines.
✨ Freemius Pricing Page 2.0
Our new pricing page is officially out of beta and now bundled into the SDK! This updated version is fully responsive and open source. It supports more pricing use cases to better fit your needs. Check it out: Freemius Pricing Page on GitHub.
Breaking Change
With the removal of the iFrame-based pricing page, any custom CSS you’ve added through the Developer Dashboard will no longer work.
We understand the breaking nature of this update. While we’re working to bring back easy customizability, for now, there are two ways you can customize the CSS or the pricing app itself.
1: Using filters to modify the CSS and variables
The pricing page uses the same structure of CSS variables as our checkout. You can leverage the templates/pricing.php
filter to print some inline CSS to modify the style.
For example:
my_fs()->add_filter('templates/pricing.php', function ( $template ) {
$style = <<<'CSS'
<style>
#fs_pricing_app {
--fs-ds-blue-10: #ECEFF1;
--fs-ds-blue-100: #CFD8DC;
--fs-ds-blue-200: #B0BEC5;
--fs-ds-blue-300: #90A4AE;
--fs-ds-blue-400: #78909C;
--fs-ds-blue-500: #607D8B;
--fs-ds-blue-600: #546E7A;
--fs-ds-blue-700: #455A64;
--fs-ds-blue-800: #37474F;
--fs-ds-blue-900: #263238;
}
</style>
CSS;
return $style . $template;
});
Please note that the CSS variables need to be applied on the #fs_pricing_app
container.
2: Replacing the entire app
You can follow the instructions outlined here to replace the pricing page application with a custom build of yours.
In the near future, we will provide you with an easier way to modify the styles of the built-in application.
🛒 Fullscreen Checkout Experience
We’ve made the checkout experience even cleaner! When checking out, users are now redirected to the new fullscreen checkout version, reducing distractions while maintaining the natural and seamless user experience you’re used to. After a successful purchase, your users will be redirected back to the WP Admin, the license will auto-activate, and they’ll see a notification with a download link to the paid version.
📬 Improved In-Dashboard Contact Form
If you’re using the in-dashboard contact form, it will now open in a new tab as a full-screen view. This change along with the others, aligns us with the latest WordPress.org guidelines—say goodbye to all iFrames in the SDK!
⚡ Improved API caching
We noticed some API request caching could consume a significant amount of memory. We have now optimized the system to not cache API requests with large amounts of data.
Fixed regression with license ownership chage
We noticed a regression from version 2.8.0, in which the system could fail to change license ownership from the UI. We have fixed this regression.
Improved Debugger, WP & PHP 8.2 Compatibility, and Various Bug Fixes
We are excited to release version 2.8.0, which includes multiple bug fixes and improvements. Please find the details below:
Improved Debugger
The Freemius SDK has a built-in debugger that, when enabled, stores all logs in the local WordPress database. We've received reports that users sometimes forget to disable it, causing the storage size to grow. To prevent this, we now automatically disable the debugger 24 hours after it is turned on.
Please note: this feature will only function if the WordPress instance has cron jobs enabled.
Improved Update Mechanism
We noticed a regression in the latest version of WordPress where updating a premium plugin via the plugin information dialog was not functioning correctly. This issue has now been resolved.
Additionally, we fixed a case where a premium-only plugin mistakenly fetched data from WordPress.org. This issue could occur if the plugin shared the same slug as another WordPress.org plugin.
Other Bug Fixes and Improvements
- Enhanced overall PHP 8.2 compatibility.
- Removed unused styles and fixed various CSS glitches.
- Added empty
index.php
files to directories that were missing them. - Modified the
pricing_url
filter to also change the pricing/upgrade submenu item. - Added URLs from
wpengine
,instawp
, and10web
to the supported list of staging sites.
Fixed the escaping in the account template
Version 2.7.4 is a patch release where we fixed an incorrect usage of an escaping function inside a template.
Fix opt-in moderation issue with API connectivity and UI glitches
Version 2.7.3 is a patch release which has the following fixes:
- We noticed an edge case that can happen due to API connectivity issue during opt-in moderation. This was causing license sync cronjobs to fail in some cases. We have identified and fixed it.
- We noticed a UI glitch in the deactivation modal. We have fixed it.
Fixed expired license notice issue, API caching, and minor UI improvements
We are releasing Version 2.7.2 of our WordPress SDK with bug fixes and UI enhancements.
Remove sticky notice when an expired license is extended
We show a sticky notice in the UI if the license is expired.
However, the product owner can extend the license from the Freemius Developer Dashboard. In such cases, we were not clearing the sticky notice. We have made improvements to clear it automatically from now on. The user needs to simply click on the "Sync" button on the "Accounts" page to make it happen.
Fixed issue in API caching
We noticed an edge case issue in the API caching layer. Sometimes, the cache would indefinitely fall back to the last valid response instead of expiring after a certain time. This was affecting the staged rollout feature. We have fixed this issue.
UI text improvements
We noticed we were using some strings in some parts of the UI that were not properly capitalized and translated. We have made fixes for the same.
Note: We have removed v2.7.1
from the release as it contained a fatal bug. If you're using v2.7.1, we urge that you upgrade ASAP.
Improved license white-labeling, enhanced PHP 8 support and various housekeeping
Version 2.7.0 brings various improvements and bug fixes. Please find them below:
Improved license white-labeling
The license keys will no longer be printed in the HTML form. This enhances the experience of white-labeled licenses.
PHP 8.* enhancements
- We noticed some translated languages broke the placeholders used in
printf
family of functions. We have fixed the translations directly in our Transifex project. - We have added some annotations in the source code to suppress some dynamic property-related issues, happening on extreme edge cases.
- Lifetime add-on license was also triggering PHP 8.1 deprecation notice in some cases. This issue was fixed as well.
Garbage Collector enhancements
We discovered an edge case where the garbage collector could delete data, in case the slug of the product was changed from the Freemius Developer Dashboard. We have introduced a fix for this.
Other bug fixes & housekeeping
- The SDK now properly checks for connectivity state when multiple Freemius-powered plugins or themes are used.
- In some cases, the SDK would promote "hidden" plans for trials. This has now been fixed.
- Fixed the incorrect signature of the
fs_enqueue_local_script
function. - We have improved the asset (CSS & JS) build process to be used against the latest NodeJS LTS.
- We have fixed the
gettext
extractor library to work for various types of custom gettext functions used in the project. - We have created another system to upload pot files from our SDK directly to our Transifex project and then update the
po
andmo
files.
For the build-tooling changes, please see the new CONTRIBUTING.md file.
Enable garbage collector by default
Starting v2.6.2 we have enabled the garbage collector system by default. More information about it can be found here.
If for some reason you want to explicitly disable it (for example, while you are developing something locally), you can do so by defining this constant in your wp-config.php
file.
// Disable Freemius WP-SDK Garbage Collector
if ( ! defined( 'WP_FS__ENABLE_GARBAGE_COLLECTOR' ) ) {
define( 'WP_FS__ENABLE_GARBAGE_COLLECTOR', false );
}
The Garbage Collector will run once every day and will clear data of any plugins/themes that have not been active for more than 1 week.
You can configure the expiration time with another constant:
// Set expiration time to 30 days
if ( ! defined( 'WP_FS__GARBAGE_COLLECTOR_EXPIRATION_TIME_SECS' ) ) {
define( 'WP_FS__GARBAGE_COLLECTOR_EXPIRATION_TIME_SECS', ( 30 * 24 * 60 * 60 ) );
}
Additionally, we also identified and fixed a typo in the logic which could have caused a regression in the GC logic.
Fix block theme preview issue on WP 6.3.2 and above
We identified (thanks to the community) that our temporary patch to fix the block theme preview issue for WP versions 6.3 and 6.3.1 had regressions for WP version 6.3.2 and above.
Since the original issue itself was a bug from the WordPress core that has now been fixed, we have scoped our fix for the specific WP 6.3 and 6.3.1 versions. We plan to remove the patch altogether after a few months when the usage is low enough. This ensures we continue supporting WP 6.3, 6.3.1, and 6.3.2+ versions.