Important WordPress Files What They Are and What They Do Important WordPress Files What They Are and What They Do

Important WordPress Files: What They Are and What They Do

Any WordPress installation unpacks a bunch of key files responsible for its functioning and behavior. Some files are core ones and others allow to control how WordPress website interacts with crawlers, what functionality is supported, how data is retrieved, how plugins are working, etc.

When WordPress is installed, its root directory will include a number of different files like wp-admin, index.php, license.txt, readme.html, and some more. However, some files often become the subject to editing and updating if some additional or advanced WordPress functions are required by the website owner but not supported by default.

We will speak of files that you probably often meet in WP tutorials on how to add a certain function in WordPress. Depending on what command you add in the following files, your website will work differently from what you had before.

This post will be complemented and updated depending on your suggestions. So let’s start.

robots.txt

Let’s start from robots.txt. As it’s seen from the name, this file is responsible for everything concerning the actions of bots that sometimes visit your website. Most common bots that attend a website are Google crawlers that walk around the Web to help search engines index and rank websites on the Web.

But even if some bots are useful for your site, other ones can bring spam or threats with them. This is why it’s important to regulate the way robots will be allowed to interact with your site. In the mid-90-s, the robots exclusion standard was created. And today we have robots.txt which includes the rules that control how robots interact with your website.

Robots.txt can either entirely block robots or restrict them to reach definite areas of your website, etc. However, there are some robots that ignore rules included in the robots.txt.

These commands are ignored by some malicious robots; some Google crawlers ignore the rules that define how frequently they can visit your website. This is why if you’ve got any issues with robots, you can use special software to scan your website for malicious activities and protect your web-page.

wp-config.php

wp-config is one of the core WordPress files including information concerning the database (name, localhost, username and password). This information is responsible for interaction between WordPress and database as well as for the storage and retrieving all WP data like posts, settings, and more.

If you need to provide WordPress with advanced options like supporting RTL or adding SSL certificate, you can edit this file to add specific commands into it.

By default there is no wp-config.php file available, there is wp-config-sample.php instead. When WordPress is installed, the sample file is renamed into wp-config.php. After that it can be suitable for installing and utilizing WordPress.

functions.php

Functions.php is a theme functions file which is used by any WordPress theme. When the theme is activated this plugin is automatically uploaded into front-end pages and admin panel of a WP website.

This file is edited to define and add functions, actions, filters and classes to be used by the theme. If you need to extend the functionality of the theme and WordPress installation itself, this file is the key one to be responsible for adding additional features.

It is located in WordPress folder and can be reached through Appearance -> Theme Editor in your admin dashboard. Most WordPress themes come with their own functions.php files but if your theme hasn’t got one, you can create a plain text file, rename it to functions.php and add it to your WordPress core folder. After that you can add the integrated WP functions and regular PHP functions into that file.

Child themes come with their own functions.php, and it can either replace the parent theme’s one or be created on the basis of the parent file. It allows to control navigation menus, post formats, and more functions.

.htaccess

.htaccess is one of the core WordPress files which the platform uses to perform its job. This is a configuration file for the Apache server mostly used by WordPress hosts. It contains the rules providing the server of your website with different instructions. Useful functions that .htaccess is responsible for are such as, for instance, improving the security of your website, redirecting your visitors to a secure version of your website, etc.

.htaccess is usually located in the central or root directory of WordPress but it is a hidden file. So if you want to open and edit it, allow your FTP client show hidden files when you enter your website through FTP. .htaccess controls how your permalinks are displayed, allows to set up 301 redirects, restricts access to your website, etc. Some plugins also add their rules to .htaccess to function properly.

This list is to be continued, so what files should be also described here? Please leave your suggestions in the comments.