Updating WordPress plugins and themes using an FTP zip unzip script is one of the fastest and most convenient methods to update multiple plugins or themes at once with one click. For the method to work, our hosting must have SSH access (standard for normal hosting). If it is not available, we recommend changing it to the one we use hosting. The description will be for Windows configuration, you can also achieve the same effect on other systems. Configuration involves simple editing of 2 files at one time.
- We must configure the free FileZilla program in such a way that after logging in to FTP it automatically goes to the directory with plugins or templates of our WordPress installation. If we have several pages, it is worth creating a separate login for each page in this way. You can read how to do it here tutorial in the section “Specifying the default directory after logging in to FTP” . Depending on the needs, we create logging only for plugins, templates, or both separately.
- We make sure that SSH on the hosting is turned on and has an assigned login and password. In case of problems, the technical support of our hosting will be helpful.
- You will need the free Putty program for an SSH connection. This is a client that allows you to log in to an SSH terminal. The description of installing this program can be found here here.
- Now we will also need an update script. We download it here.
- The folder with the script can be placed anywhere on the disk.
- If we rename a folder, it cannot have spaces in its name.
- All files in the folder must remain unchanged in the same place in the folder.
- The folder with the script must be separate for updating plugins and templates (different configuration). If we need it for both of these things for one page, we make a copy of the script folder along with the contents. Similarly, each subsequent website (domain) must have its own directory for updating plugins and templates for the same reason.
5. First open the file using a notepad or other text program script-unzip.sh We are only interested in the line:
cd PAGE-DIRECTORY / public_html / wp-content / plugins
This command goes to the appropriate folder on SSH after running the script. It works the same way as in FileZilla, moving to the set remote login directory. The address should be identical to that in the FileZilla program, assuming that our SSH login takes us to the same directory as the FTP login after logging in. If we use the main FTP and SSH login for hosting, it will take us to the same place, to the main root directory. The easiest way to check this is to log into SSH using Putty and type the command ls . After approval, you should see a list of the main directories of our sites. In the case of FTP, after logging in, you should see the same in the right window of the program.
In this file we only change “SITE-DIRECTORY” to the name of our website's directory (where it is installed on the hosting). In the case of our store and plug-in configuration it will be allkeystore.pl and the configuration will look like this:
It is also best to check on FTP that the public_html directory is definitely present. In the case of some hostings, it is not available, and the public content of the website is located directly in the website directory (usually the domain name). If it is not there, we remove only “public_html” from the URL path, making sure there are no double “//”.
The above configuration is for plugin updates. In the case of templates, it looks the same, we only change “plugins” at the end to “themes”. Of course, this should be done in a separate copy of this folder for updating templates.
We can also modify this code in such a way that after unpacking all the zip files and overwriting the files, the script leaves the "plugins" directory, goes to the "themes" directory and performs the operation again. The code will look like this.
Please note that in a situation where we do not have any zip files in the plugins or templates directory, an error will appear. It is not verified in this script so as not to complicate it, however, do not worry about it in such a situation. Of course, you can extend this script further to update all our pages, etc.
6. After editing, script-unzip.sh and saving changes we edit start.bat in the notebook. This is a Windows executable that will run the PLINK utility that comes with Putty, which in turn will run the script we just edited. In this file, we only change “YOUR-LOGIN-SSH” to our SSH login and “YOUR-PASSWORD-SSH” to the SSH password.
Be careful that all spaces are kept exactly as they are in the original file. We save the changes.
7. At this point our script is ready. The last thing is to create a shortcut to the start.bat file. We can name this shortcut anything, e.g. "UPDATE MOJASTRONA.PL PLUGINS" and move it to any place so that it is convenient for us to run it. If we have several pages and create several shortcuts, it is worth moving them all to one folder for convenient use.
8. If we haven't migrated the plugins or templates zip files to update yet, we're moving them now. The description of how to do this is here .
IMPORTANT DIFFERENCES AND CHANGES AS THE DESCRIPTION ABOVE:
- This description is about updating plugins and templates via FTP, and we only want to move the zip files to the right places. We do not transfer unpacked directories with plugins or templates to the "plugins" and "themes" directories on FTP as described in this article, but zip archives with plugins and templates from us do so in exactly the same way.
- We need to make sure that we are copying the zip files of plugins and templates that are suitable for installation. Sometimes developers package plugins and templates together with documentation, demos, etc. and the plugin or template is just one of the zip files. If we unpack something like this on FTP, the update will fail and we will have to manually delete all incorrectly unpacked files. There is no such problem if we update plugins and templates downloaded from us. If a plugin or template from us is packed together with something, the file always has "UnzipMe" in its name. You should then unpack it and transfer the appropriate zip files of plugins and templates. It is best to click on them and check the contents. If there is only one directory in the zip archive with a plugin/template name or similar, this is the update/installation zip file. If you are not sure, you can try to install this file through the WP panel. If you receive the error "No properly prepared plugins (or templates) found", it means that it is not the right file. There may also be a "__MACOS" directory for Mac OS systems there, but our script deletes it automatically.
9. Run the script by clicking on the shortcut. A black console window will appear on which commands will be executed, after which the window will disappear and the text file log.txt to which warnings and errors have been transferred from the console will be opened automatically. If everything was successful, you should see "X archives were successfully processed"
10. Check in the WP admin panel whether plugins / templates have changed versions.
If we have several pages, we can also create a .bat file that will run all our bat files at once. This allows us to update all plugins and templates on multiple sites with one click.
FINAL ADVICE:
When moving zip files by dragging them to FileZilla, be careful not to move these zip files to the directory of any installed plugin and template. It is best to solve this problem by creating, for example, 3 files named 'aaa', 'bbb', 'ccc' without any extension, and moving them to the plugins or templates directory of our website. Then, when sorting by name in FileZilla, click on "Filename" and our 3 files will always be at the top when sorting. We drag our zip files onto these 3 files. Then they will always be transferred correctly to the root directory of files and templates.