Support » Plugin: Swift Performance Lite » Please do not use static path in must-use plugin. Breaking staging sites!

  • Resolved Rene Hermenau


    Hi guys,

    I am the developer of WP Staging

    In your must-use plugin you are using a static path like this:

    $plugin_file = '/home/public_html/wp-content/plugins/swift-performance-lite/performance.php';

    WP Staging creates staging sites in sub folders like It’s also cloning the must-use plugins.

    This code is breaking users staging sites and lead to fatal errors when they create a staging site with WP Staging and other cloning plugins (Error Cannot declare class Swift…) This happens because WP Staging clones an entire site which includes the must-use plugins, too.

    So instead of using a static path please switch over to a dynamic approach like the one below:

    $plugin_file = ABSPATH '/wp-content/plugins/swift-performance-lite/performance.php';

    This should be working.


Viewing 12 replies - 1 through 12 (of 12 total)
  • Thx a lot for this input, I draw attention to your feedback to Swift’s author. He knows about it now, hopefully he will find a way to solve this one.

    • This reply was modified 1 year, 7 months ago by Ivica Delic.

    Thank you very much:-)

    Rene could you review my post and advise where to correct this error? I believe its the same one effecting me.


    @homegrownandy In folder wp-content/mu-plugins you find the swift must use plugin.

    Just do the code changes there and it is hopefully working.

    Otherwise, remove the must use plugin on the staging site. This should also fix it.

    If you really have the same issue please open another ticket here with the same issue. We need to make the developer of the swift plugin aware that this is a serious issue which needs to be fixed.

    PS Author found a way how to fix this, but not using the way you described due to other technical limitations of that solution, he had some other fix on his mind.


    Is this issue still persistent in swift performance? (not lite version)

    I’ve got a user who gets the fatal error:

    PHP Fatal error: Cannot declare class Swift_Performance, because the name is already in use in /home/ on line 12

    In version 1.8.6

    Plugin Contributor Fred


    It’s a known bug, and we have already fixed in next release. In a couple of days Swift 2.0 for Pro users will be available.

    @fredawd Good to hear. Thanks mate

    Just to make sure: Is this error going to be fixed in free version as well?

    Have another user with that error who is using swift lite plugin 2.0.1

    Fatal error: Cannot declare class Swift_Performance_Lite, because the name is already in use in

    Plugin Contributor Fred


    @renehermi, this error is fixed in free version (2.0).

    Most likely user need to uninstall Swift from dev/staging installation and have a clean / new Swift installation. Can you see if that solve this issue?


    @fredawd Thank you. Will recommend that to my user.

    Happy New Year, mate

    Reopened, because it is still not fixed!

    Used plugin Swift Performance: 2.0.11

    After creating a staging website with WP Staging, the swift mu-plugin throws a fatal error.

    Until this is fixed I am going to exclude the swift plugin for any new staging site created with wp staging.


Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Please do not use static path in must-use plugin. Breaking staging sites!’ is closed to new replies.