Not sure how to upload your WordPress plugin or theme in SVN Repository after getting the approval? I know, It’s a lot of difficult and hard work process to create a WP plugin, submitted them for review, and getting approval from the WP team.
Along with the approval of your plugin, they’ve provided you with an SVN repository link and you have got no idea on how to use it? So, this guide is especially for you and here I’ll tell you the complete process of submitting your plugin to the SVN repository as well as to manage your plugin and update them to the newer version.
💡Things to Keep in Mind
- SVN CLI (Command Line Interface) comes pre-installed in your macOS and Linux systems, if not you’ve to open your terminal and paste this code “
brew install svn” to install SVN).
- If you’re using Windows OS, you’ve to download TortoiseSVN to manage your repository (you’ll also get an option to install CLI with it).
After installing this application on Windows, you can follow these steps below and if you are on macOS then you don’t need to install anything there.
But before getting started, it’s important to know…
What is WordPress SVN?
SVN is a version control system that is similar to Git. It can be used via the command line and has many similarities to Git.
The main difference between SVN and Git is that SVN uses a centralized repository of files, while Git allows users to maintain their own repositories locally. The second main difference is that SVN uses a complete history of all changes, while the default for Git is an abbreviated history.
The work in SVN is comprised of three parts:
How to Add WordPress Plugin to SVN Repository
I know you’re waiting for this point for a while, but your search ends here. Here I’m sharing the steps to easily upload your first plugin in the SVN repository of WordPress and make them publicly accessible.
It only takes a few steps to upload your plugin into WordPress and here we’ll use the SVN CLI method for uploading the plugin.
Steps to Follow
In order to work on your plugin, you’ve to copy the SVN link which is provided by the WordPress team to you and download all the files from there to your local directory.
I’ve created a plugin named “User IP and Location“, so they’ve provided SVN repository link “https://plugins.svn.wordpress.org/user-ip-and-location/” to me.
Once the SVN link is created for my plugin, I’ll open the terminal and create a folder named anything I want (most probably the plugin name, i.e., User IP and Location). Now, you have to run a command I shared below in the same directory to download everything from the SVN link to your local system.
After running this SVN command in your terminal, it will download four folders from the SVN folder to your local desktop. These folders are;
Now, you’ve to copy the code of your plugin which you created inside
./trunk/ folder and all your banner and icons inside
Once you’ve added the files in their respective folders, you’ve to again open the terminal and go inside your local directory using the
cd Your-Directory-Name command and run the command shared below.
After running this command, all files are added to the directory and ready to commit to the SVN repository. Once it is done, you’ve to commit the plugin to the WordPress repository using the command shared below.
It will ask you for your password and then it will successfully commit the plugin to the WordPress repository and your plugin will be available within a few minutes in WordPress.
How to Update WordPress Plugin Using SVN
Once your plugin is uploaded, you’ve to make a few changes in the future and update your plugin frequently to make it compatible with the latest version of WordPress. In this case, you’ve to use the steps shared below to update your plugin.
First, you’ve to create a folder in your local system and download all your plugin files from the SVN link using the command shared below.
After this, you’ve to create a folder inside the
./tags/ folder and create a folder containing your older plugin version.
For example, if you’ve initially launched your plugin with the 1.0 version, then you’ve to create a folder named
./tags/1.0/ and import all files from
./trunk/ folder to there.
After that, you’ve to update the code inside
./trunk/ folder with the latest one, and then you’ve to use
svn up command inside of your plugin folder. It will bring changes from the repository into your working copy.
Once it is done, you’ve to check the stats of updated files using the command shared below.
It will check if the file is successfully added or not. Here, the “M” for those files which are updated and available previously and “?” for those files which were not present previously.
Now, you’ve to add the files mentioned with “?” in your script using the code I shared below;
This command will recursively add all files marked with “?”. If this command is not working for you, then also add
--force syntax just before the
trunk/* value and it will forcefully add the files in your working copy.
Once it is done, you’ve to commit your plugin to the WordPress repository using the command I’m sharing below.
Once it is done, you’ll see the updated version of your plugin within a couple of seconds in the WordPress repository.
Using SVN can be complicated sometimes but in this guide, I’ve tried my best to explain how I uploaded my first plugin in WordPress repository without any issue. I hope this guide helps you in uploading yours.
Feel free to connect with us, if you’re getting any issue while publishing or updating your WordPress plugin. I’ll try my best to help you out or if you’ve got any queries, you can reach us via the comment form given below.
Now it’s your time to publish your first plugin in the WordPress repository and all the best for it. 😊