How to update WP plugin / theme from external host

by 6 replies
8
For example i host a wordpress plugin / theme on my own host, and i want my plugin / theme users to update the plugin / theme, what code should i add on my plugin / theme.

I've known code to download file & unzip it manually, but i guess it won't be convenient because it won't use the normal and friendly wordpress update interface.

Thanks for the help
#programming #external #host #plugin #theme #update #wordpress
  • Dear Friend,

    I cannot get your question clearly
  • With all of the issues that WP itself has experienced with automatic upgrading, it might be good to just leave well-enough alone and display a notice to your users when the plugin is out of date.

    Dig into the WP code, specifically wp-includes/http.php, and wp-includes/class.http.php to see how WP does it. You can probably use some or most of the same code.
    • [1] reply
    • i needed an answer to this recently, and agree with the above post. its best to do it yourself.


      the way i have done it is to:

      1. check credencials (with my api)
      2. request latetest version
      3. download file
      4. unzip and place in plugins folder.


      i tried a few ways to deactivate old version and activate new one (problems when calling from the same script).

      so i simply display a message asking the user to deactivate the old and activate the new.

      the proccess is quite simple, and wordpress has some hidden gem functions for this:


      download_url();

      give it the url and it downloads the response to a temp file.

      unzip_file();

      unzips the temp file, and sends to destination




      the great thing about the above functions is that they do all the leg work (unzip checks if zip extension installed, if not uses plczip)(download checks i it needs to use curl or other)





      that should be enough to get up and running, hope it helps
  • Do you mean that you want the plugin users to be notified in their admin that the plugin has a new version and they can download and activate from the plugins page in admin?

    If so, I think you need to submit your plugin to WordPress here : WordPress › Requests « WordPress Plugins

    It's a pretty good resource for plugin developers because you get quite a lot of traffic from people browsing the wordpress plugin repository. You also get download stats for your plugin too.
    • [1] reply
    • Thanks i guess this is what i need, no more pain on curl etc

      Thanks, but i mean paid plugins which can't be hosted on wp.org
      • [1] reply

Next Topics on Trending Feed

  • 8

    For example i host a wordpress plugin / theme on my own host, and i want my plugin / theme users to update the plugin / theme, what code should i add on my plugin / theme. I've known code to download file & unzip it manually, but i guess it won't be convenient because it won't use the normal and friendly wordpress update interface.