Back in the day, websites were “web sites” and created using basic HTML.
Then came WordPress. Now “websites” really do not require coding knowledge to add and modify your content and media.
My clients like WordPress because they can find a premium theme and tweak their site to look the way they want without being a professional coder. With the Gutenberg editor, you don't even need to know the handful of basic HTML snippets previously necessary to format your posts and widgets.
Table of contents
Where do I change WordPress files?
First, we need to ask, “which files and why”? Rarely, if ever, as a website owner, would you need to modify the WordPress core files.
Some folks jump over to Appearance > Editor and start modifying the .php files within. They then end up with a broken site.
That is why many hosts have that area “turned off” by default. If you don't understand the layout and syntax of .php, stay out of the file editor area.
However, there will be times that you do want to tweak specific files. Below is an overview of WordPress's file structure, including the commonly modified files (with great care).
WordPress File Locations
Depending on your hosting setup, you may have a File Manager interface in your cPanel or hosting dashboard where you can access your files. Or you have the option of “FTPing” into your server.
I use and recommend Filezilla, a free FTP (File Transfer Protocol) software program. You input your FTP settings, as provided by your host, and you'll be able to view your server's directory tree. They'll be similar to the images in this post.
You can find your website files in the root of your server, which is in the “public_html” or just the “html” directory.
In the root are all the core WordPress files. The only files you may need to modify in the root if you are confident that you know what you are doing would be:
Website owners use the /robots.txt file to give instructions about their site to web robots, known as The Robots Exclusion Protocol. Robots.txt starts with:
The “User-agent: *” means this section applies to all robots. The “Disallow: /” tells the robot that it should not visit any pages on the site.
The .htaccess file is used to alter the Apache Web Server software configuration to enable/disable additional functionality and features that the Apache Web Server software has to offer.
One of the most critical files in your WordPress installation is the wp-config.php file. This file is located in the root of your WordPress file directory and contains your website's base configuration details, such as database connection information.
The wp-admin directory is where all the backend WordPress Dashboard files are located — no reason for you to change any files there.
The wp-content directory is where you'll find your plugin, theme files, and uploads. While there are other directories there, you most likely will never have to go into those.
The plugins directory will have all your plugin files. Rarely will you need to modify files within, if at all.
The themes directory is where your theme files are located. The style.css file is the file most size owners will want to modify as this file contains the global font sizes, colors, and spacing for your theme.
Did you know you have an option not to have to modify that file to make CSS changes? Just go to Appearance > Customize > Additional CSS. There you can add modified snippets that will override your theme's CSS file.
Still want to modify the style.css file?
- Suppose you have a child theme. That is the style.css file you want to modify. It is located in your child theme's folder (themes/agency-pro in the example graphic). You do not want to change your framework's style.css (themes/genesis in the example graphic). When Genesis updates, so will the Genesis style.css, and your modifications will be lost.
- Do not have a child theme? Without a child theme, it becomes necessary for you to keep detailed notes or revision copies of every change you make to any file, including the style.css. This is because when your theme updates, all those tweaks will be overwritten and have to be reapplied. Using a child theme, you ensure that your modifications are preserved when your framework, also known as the parent theme, is updated.
The uploads directory will have all the graphics and files you have uploaded for your pages and posts. By default, uploads are organized by year/month.
Unless you are a skilled developer, there will never be a reason to change any files in the wp-includes directory. This directory includes the packages that are part of the core maintained by the WordPress core team. Therefore, your themes and plugins can rely on those packages to be available for any given version of WordPress.
Before Modifying Any File…
When modifying any files, you should always copy the original and save it on your hard drive. This way, if you do not like the results, you can quickly restore the entire original file and code — then go back to the drawing board.
At your service,