Skip to content

Freemius SDK Fails to Load Styles When Plugin Is Symlinked #834

@protibimbok

Description

@protibimbok

Bug Report: Freemius SDK Fails to Load Styles When Plugin Is Symlinked

Summary:
When using the Freemius WordPress SDK with a plugin that is symlinked (instead of being physically located inside the wp-content/plugins directory), asset URLs for SDK styles are incorrectly resolved — causing CSS files not to load in the WordPress admin.


Steps to Reproduce

  1. Create a WordPress plugin outside the WordPress installation directory (e.g., ~/dev/plugin).

  2. Initialize Freemius in the plugin as usual.

  3. Create a symbolic link from your plugin directory into wp-content/plugins:

    ln -s ~/dev/plugin /path/to/wordpress/wp-content/plugins/my-plugin # Notice the different names
  4. Activate the plugin in WordPress.

  5. Open the WordPress admin area where Freemius styles should load. (Plugins page)


Expected Behavior

Freemius SDK assets (CSS/JS) should load correctly using URLs relative to the site’s wp-content/plugins path, even when the plugin directory is a symbolic link.


Actual Behavior

The asset URLs are generated incorrectly, resolving to an invalid path that includes the absolute file system path of the symlinked plugin.

Examples of generated URLs:

  1. <wordpress-url>/wp-content/themes/<absolute path of plugin_dir>/vendor/freemius/wordpress-sdk/assets/css/admin/optout.css?ver=6.8.3
    
  2. <wordpress-url>/wp-content/themes/<absolute path of plugin_dir>/vendor/freemius/wordpress-sdk/assets/css/admin/dialog-boxes.css?ver=6.8.3
    
  3. <wordpress-url>/wp-content/themes/<absolute path of plugin_dir>/vendor/freemius/wordpress-sdk/assets/css/admin/common.css?ver=6.8.3
    

As a result, these CSS files fail to load.


Environment

  • WordPress Version: 6.8.3
  • Freemius SDK Version: 2.12
  • PHP Version: 8.4.5
  • Operating System: Ubuntu 25.04
  • Plugin Structure: Symlinked from outside WordPress root

Plugin

  • Name: WP Table Builder
  • Slug: wp-table-builder
  • Freemius ID: 6984

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions