Last updated - February 24, 2020
WordPress is known for its ease of use and customizability right out of the box. A person with no coding experience can set up a WordPress site in minutes, it’s that simple! Despite the functionality that it offers, there may be times when you need to access the source code of your site. It could be to make your plugins compatible with installed themes, debugging or making customizations beyond those offered by themes and plugins. So we are going to go over the steps to follow to make edits to your WordPress source code files.
What does WordPress run on?
WordPress is a PHP and MySQL based free and open source content management system. Mostly used for blogging, it can be used to run almost any type of website. Even multi-billion dollar companies like Sony Music use WordPress to power their sites.
What makes WordPress truly the best is the plugin and template add-on style simplicity when it comes to adding extra functionality. Powering over 30 percent of the top 10 million sites, WordPress is the most popular content management system out there.
Making a backup:
The changes being made to your WordPress source code files can break your site if you make a mistake. Hence, always make a backup before you edit any files. In case you make any mistake, you can simply replace the files with your backup. You can use one of the many backup plugins like UpdraftPlus or simply copy over the files from your FTP client.
How to Edit WordPress Source Code Files?
Here is a video to help you understand the process step by step.
Accessing the HTML of your WordPress site is pretty straight forward. If you wish to edit posts on your WordPress site, you can simply access the HTML by switching from the Visual editor to the Text editor. You can make changes and update the post.
Should you need to edit the HTML of your homepage, you can do so from the Appearance tab in your Dashboard. Under Appearance choose Widgets and pick ‘Manage with Live Preview’ to view your homepage edits in real time.
Editing PHP and CSS:
You can access the PHP and CSS WordPress source code files through the Appearance Editor or by using an FTP client. Inside your WordPress dashboard, you can access the Editor under Appearance.
You can access different theme files you’ve installed from the Editor. Navigate to the file you need to edit and after making all the changes to your WordPress source code files, click on ‘Update File’. The changes are then live.
File Transfer Protocol (FileZilla):
You can use a file transfer protocol client to connect to your WordPress server and make changes. FileZilla and Cyberduck are two opensource clients that you can download and install. You will also be needing FTP login credentials for your site. Web hosting providers usually send this information when you sign up for a server. If you don’t have your FTP credentials, you’ll have to contact your hosting provider.
Using FileZilla FTP client, first connect to your WordPress server: You need to give the site address, username, and password to log in. The default port for FTP servers is 21. Next, click on Quickconnect.
And you’re in. You can navigate through the files on your server from this window.
When you find the file you need to edit, right-click and choose View/Edit. This downloads that file locally on your machine. FileZilla lets you choose your own program to open the file with. So you can configure FileZilla to open your WordPress files with an editor or IDE as well.
After you’ve made all the necessary changes, when you close the file, FileZilla uploads the file back to the server automatically. If you’ve downloaded the file instead of choosing ‘View/Edit’ you will have to upload the file manually for the changes to take effect.
So these are the two ways you can access and edit WordPress source code files. Doing this gives you complete control over your site. Between this and the thousands of plugins and themes available, you can make your WordPress site do what you wish.