Run your WordPress synchronously with FTP or SFTP in Visual Studio Code

Running WordPress synchronously with FTP or SFTP (Secure File Transfer Protocol) in Visual Studio Code involves setting up a development environment where you can edit your WordPress files locally and have them automatically synchronized with your remote server when changes are made.

Install an FTP/SFTP Extension:

To utilize the SFTP extension, ensure that Visual Studio Code is installed on your system. To install the extension, open the editor and navigate to the Extension icon in the left sidebar. In the search field, enter “sftp,” and you’ll find a list of available extensions.

SFTP by Natizyskunk

Using the SFTP Extension in VS Code

If the latest files are already on a remote server, you can start with an empty local folder, then download your project, and from that point sync.

  1. In VS Code, open a local directory you wish to sync to the remote server (or create an empty directory that you wish to first download the contents of a remote server folder in order to edit locally).
  2. Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on Mac open command palette, run SFTP: config command.
  3. A basic configuration file will appear named sftp.json under the .vscode directory, open and edit the configuration parameters with your remote server information.For instance:
    "name": "Profile Name",
    "host": "name_of_remote_host",
    "protocol": "ftp",
    "port": 21,
    "secure": true,
    "username": "username",
    "remotePath": "/public_html/project", //This is the path which will be downloaded if you "Download Project"
    "password": "password",
    "uploadOnSave": false

    The password parameter in sftp.json is optional, if left out you will be prompted for a password on sync. Note: backslashes and other special characters must be escaped with a backslash.


  4. Save and close the sftp.json file.
  5. Ctrl+Shift+P on Windows/Linux or Cmd+Shift+P on Mac open command palette.
  6. Type sftp and you’ll now see a number of other commands. You can also access many of the commands from the project’s file explorer context menus.
  7. A good one to start with if you want to sync with a remote folder is SFTP: Download Project. This will download the directory shown in the remotePath setting in sftp.json to your local open directory.
  8. Done – you can now edit locally and after each save it will upload to sync your remote file with the local copy.

The SFTP extension for VS Code is highly robust. Detailed information on configuring it for various use cases can be found in the official GitHub repository:

0 Points