1

So I have hooked the wordpress plugin auto updated to effectively redirect my plugin to autoupdate from my own site rather than wordpress.com.

The updating process works seemlessly aside from one wierd hitch - the wordpress updater downloads the my_plugin.zip file from my server, saves it in a temp directory as my_plugin-3sd123.tmp (where the random string is generated by the wp updater to avoid file conflicts) and unzips it to wp-content/upgrades which leaves a directory my_plugin-3sd123 in updates and then it copies this directory to plugins and removes the old directory BUT never renames the new one to the old plugin slug.. Should I be writing my plugins to expect this? because I dont see it happening with other plugin updates?

1 Answer 1

2

It turns out the answer was simple I didnt have my plugins content in a subdirectory slug inside the zip file eg. I had :

my_plugin.zip
   |- my_plugin.php
   |- admin
        |-admin.php

I should have had

my_plugin.zip
   |-my_plugin
        |-my-plugin.php
        |-admin
            |-admin.php

Once you add that sub directory the auto updated will work as expected

1
  • I have the same plugin structure like your second example, but the folder still gets renamed with a random string somehow. Any idea what else can cause this?
    – Loosie94
    Aug 8, 2023 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.