Logo: Wp Freemius

Wp Freemius

Communautéit
mralaminahamed
wp-freemius

Use when integrating Freemius SDK into a WordPress plugin for monetisation — SDK bootstrap with fs_dynamic_init, feature gating with can_use_premium_code() / is__premium_only() / is_plan() / is_trial() / is_paying(), license management, free/pro dual-zip build using __premium_only__ file suffix, generating upgrade URLs with get_upgrade_url(), opt-in analytics dialog, multisite licensing, affiliate program, or debugging Freemius dashboard (Plans, Pricing, Licenses, Updates). Triggers: "add Freemius to my plugin", "gate this feature behind pro", "show the pricing page", "check if user has a license", "Freemius not initialising", "can_use_premium_code()", "is_plan()", "is_trial()", "is_paying()", "fs_dynamic_init", "my_plugin_fs()", "__premium_only__ file", "set up free and pro versions", "Freemius opt-in dialog", "trial period setup", "license key validation", "monetise my plugin", "get_upgrade_url()", "Freemius affiliate", "is_org_compliant", "Freemius SDK error", "free and premium zip", "Freemius multisite", "Freemius GlotPress translations". Not for: WooCommerce payments — use `wp-woocommerce`; WP.org trialware compliance — use `wp-org-submission`.

Iwwersiicht

Editeurmralaminahamed
Repositorywp-dev-skills
Skill-Nummwp-freemius
Stären
29
Forks
3
Matgeliwwert Dateien
4
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 4 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    mralaminahamed huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Wp Freemius an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/mralaminahamed/wp-dev-skills/tree/trunk/skills/wp-freemius
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mralaminahamed/wp-dev-skills.git /tmp/wp-dev-skills
mkdir -p .claude/skills
cp -r /tmp/wp-dev-skills/skills/wp-freemius .claude/skills/wp-freemius
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Wp Freemius an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Wp Freemius automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Wp Freemius net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Freemius SDK Integration

Model note: SDK bootstrap and basic feature-gating are pattern-matching (haiku). Trialware compliance audit and pricing-plan architecture decisions require careful judgment — use sonnet for those.

Integrate Freemius into a WordPress plugin for commercial distribution: SDK bootstrap, free/pro feature gating, license management, trials, pricing page, and the Freemius dashboard. Freemius handles payments, license keys, update delivery, and analytics.

When to use

  • "Add Freemius to my plugin", "set up free/pro version", "implement license management".
  • "Gate premium features behind a license", "add a trial period".
  • "Create a pricing page", "set up a Freemius affiliate program".
  • "Debug Freemius SDK not loading", "fix opt-in dialog not showing".
  • "Configure Freemius for multisite licensing".

Not for: General WooCommerce payment flows — use wp-woocommerce. WP.org trialware compliance (Freemius-powered upsells must follow WP.org Guideline 5 — use wp-org-submission, which contains references/trialware-compliance.md).

Method

1. Create a Freemius account and app

  1. Sign up at https://freemius.com
  2. Create a new Plugin product in the Freemius dashboard
  3. Note down: Plugin ID, Public Key, Secret Key
  4. Configure pricing plans (Free, Pro, etc.) in the dashboard

2. Install the SDK

Via Composer (recommended):

bash
composer require freemius/wordpress-sdk

Manual: Download from https://github.com/Freemius/wordpress-sdk and place in vendor/freemius/.

3. Bootstrap the SDK

Create includes/freemius.php (the Freemius singleton init file):

php
<?php
if ( ! function_exists( 'my_plugin_fs' ) ) {
    function my_plugin_fs() {
        global $my_plugin_fs;

        if ( ! isset( $my_plugin_fs ) ) {
            // Include the Freemius SDK
            require_once plugin_dir_path( __FILE__ ) . '../vendor/freemius/wordpress-sdk/start.php';

            $my_plugin_fs = fs_dynamic_init( [
                'id'             => '12345',                            // Plugin ID from dashboard
                'slug'           => 'my-plugin',                       // WP.org slug
                'type'           => 'plugin',
                'public_key'     => 'pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // Public key
                'is_premium'     => false,                              // true if this IS the premium build
                'has_premium_version' => true,                          // true if premium version exists
                'has_addons'     => false,
                'has_paid_plans' => true,
                'trial'          => [
                    'days'               => 14,
                    'is_require_payment' => false,                      // true = credit card required
                ],
                'menu'           => [
                    'slug'    => 'my-plugin',
                    'contact' => false,
                    'support' => false,
                ],
            ] );
        }

        return $my_plugin_fs;
    }

    // Init Freemius
    my_plugin_fs();

    // Hook Freemius after initial plugin setup
    do_action( 'my_plugin_fs_loaded' );
}

Load from main plugin file:

php
// At the top of my-plugin.php, before any premium-gated code
require_once plugin_dir_path( __FILE__ ) . 'includes/freemius.php';

4. Feature gating

Gate premium features consistently throughout the codebase:

php
// Check if user has an active paid plan (or trial)
if ( my_plugin_fs()->can_use_premium_code() ) {
    // Show/run premium feature
    require_once plugin_dir_path( __FILE__ ) . 'includes/class-premium-feature.php';
}

// Check if the premium code file is loaded (for the __premium_only__ pattern)
if ( my_plugin_fs()->is__premium_only() ) {
    // Always true when premium file is present
}

// Specific plan check
if ( my_plugin_fs()->is_plan( 'professional', true ) ) {
    // $true = or_greater: matches 'professional' and any higher plan
}

// Trial check
if ( my_plugin_fs()->is_trial() ) {
    echo 'Trial active: ' . my_plugin_fs()->get_trial_plan()->title;
}

// Free user upsell prompt
if ( ! my_plugin_fs()->is_paying() ) {
    // Show upgrade CTA
    $upgrade_url = my_plugin_fs()->get_upgrade_url();
}

__premium_only__ file pattern — Freemius strips these files from the free build:

my-plugin/
├── includes/
│   ├── class-core.php              # Free + premium
│   └── premium/                    # Only in premium zip
│       └── class-advanced.php__premium_only__

5. Pricing page

Freemius generates a hosted pricing page. Embed in the plugin's admin:

php
add_action( 'my_plugin_fs_loaded', function() {
    my_plugin_fs()->add_submenu_link_item(
        __( 'Upgrade', 'my-plugin' ),
        my_plugin_fs()->get_upgrade_url(),
        'upgrade',
        'manage_options',
        51,
        'dashicons-star-filled',
        true  // is_external: opens pricing in new tab
    );
} );

// Or embed the pricing page directly inside WP admin
function my_plugin_pricing_page() {
    echo my_plugin_fs()->get_pricing_js_tag( true );
}

6. Opt-in analytics

Freemius prompts users to opt into anonymous data collection on activation. Customise the dialog:

php
$my_plugin_fs = fs_dynamic_init( [
    // ...
    'opt_in' => [
        'type'        => 'dialog',     // 'dialog', 'inline', or 'none'
        'is_enabled'  => true,
        'anonymous_mode_enabled' => true, // allow "skip" without opting in
    ],
    'is_org_compliant' => true,  // WP.org: must allow "skip"
] );

// Skip opt-in programmatically (for white-label / privacy-first)
add_action( 'my_plugin_fs_loaded', function() {
    my_plugin_fs()->skip_connection();
} );

7. Multisite licensing

Configure in fs_dynamic_init():

php
'is_premium'               => false,
'has_premium_version'      => true,
'license_key_grace_period' => 7,     // days after expiry before locking
'bundle_id'                => null,  // set if part of a bundle
'network_key_type'         => 'per-site',  // 'per-site', 'per-domain', 'unlimited'

Options:

  • per-site — each subsite needs its own license activation
  • per-domain — one license covers all subsites on the same domain
  • unlimited — one license covers all

8. Freemius dashboard integration

Key dashboard pages to configure:

  • Plans — name, price, features per plan, billing cycle (monthly/annual)
  • Pricing — set currency, pricing page URL
  • Affiliates — enable affiliate program, commission rate
  • Licenses — activation limits per license key
  • Updates — premium zip is auto-served via Freemius CDN on license activation

SDK update delivery — authenticated users receive updates via the Freemius API (not WP.org). The SDK hooks into WP's update mechanism automatically:

php
// No extra code needed — Freemius handles wp_update_plugins transparently

9. Common SDK issues

Opt-in dialog not showing:

  • Check 'opt_in' => [ 'type' => 'dialog' ] in init config
  • Verify user has manage_options capability
  • Clear fs_accounts option: delete_option( 'fs_accounts' )

"Invalid API Secret Key" error:

  • Never expose secret key in client-side JS or public code
  • Rotate key in Freemius dashboard if exposed

Premium features visible without license:

  • Ensure can_use_premium_code() wraps ALL premium code paths
  • Check that the free zip doesn't include __premium_only__ files

SDK conflicts with other Freemius plugins:

  • Freemius uses a global $fs_active_plugins object. Conflicts resolved by SDK auto-loader — ensure only one copy of the SDK is loaded (use if ( ! function_exists( 'fs_dynamic_init' ) )).

Notes

  • Freemius is_org_compliant must be true for WP.org–hosted plugins. Without it, the opt-in dialog blocks deactivation — a violation of WP.org guidelines.
  • The free version (on WP.org) and premium version (via Freemius) are separate zips. Build both from the same codebase using the __premium_only__ suffix.
  • Never gate plugin activation behind a license key (Guideline 5 / trialware). Freemius can_use_premium_code() returns false but the plugin must remain fully functional in free mode.
  • Secret key must never be committed to git. Store in a CI secret or server env var; inject at build time.
  • For WooCommerce extensions sold on WooCommerce.com, consider WooCommerce's own licensing API instead of Freemius.

References

  • references/feature-gating.md — Freemius feature gating patterns: can_use_premium_code(), is_paying(), plan-level checks, and free-tier fallback patterns
  • references/freemius-config.md — fs_dynamic_init() full parameter reference: all config keys, common configurations, and multi-plugin setup
  • references/pricing-page.md — Freemius pricing page URLs, checkout flow, upgrade redirect patterns, and dashboard link generation

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Wp Freemius?

Use when integrating Freemius SDK into a WordPress plugin for monetisation — SDK bootstrap with fs_dynamic_init, feature gating with can_use_premium_code() / is__premium_only() / is_plan() / is_trial() / is_paying(), license management, free/pro dual-zip build using __premium_only__ file suffix, generating upgrade URLs with get_upgrade_url(), opt-in analytics dialog, multisite licensing, affiliate program, or debugging Freemius dashboard (Plans, Pricing, Licenses, Updates). Triggers: "add Freemius to my plugin", "gate this feature behind pro", "show the pricing page", "check if user has a l...

Firwat Wp Freemius op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Wp Freemius besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Wp Freemius an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/mralaminahamed/wp-dev-skills/tree/trunk/skills/wp-freemius an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Wp Freemius benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Wp Freemius benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Wp Freemius domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Wp Freemius gratis?

Jo. mralaminahamed huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇