
WordPress 目录结构
您想了解 WordPress 文件和目录结构吗?核心 WordPress 软件、主题、插件和用户上传都存储在您的网站上。在本初学者指南中,我们将解释 WordPress 文件和目录结构。
您想了解 WordPress 文件和目录结构吗? WordPress 的核心软件、主题、插件和用户上传都存储在您的网站上。在本初学者指南中,我们将解释 WordPress 文件和目录结构。

为什么您应该了解WordPress文件和目录结构? (Why You Should Learn About WordPress File and Directory Structure?)
大多数用户无需了解 WordPress 文件或目录即可运行其 WordPress 网站。但是,了解 WordPress 如何存储文件和目录可以帮助您自行解决许多常见的 WordPress 问题。
大多数用户不需要知道 WordPress 文件或目录来运行他们的 WordPress 网站。然而,了解 WordPress 如何存储文件和目录可以帮助您自己解决许多常见的 WordPress 问题。
本指南将帮助您:
本指南将帮助您:
- Learn which WordPress files and folders are core files. 了解哪些WordPress文件和文件夹是核心文件。
- Understand how WordPress stores your images and media uploads. 了解WordPress如何存储您的图像和媒体上传内容。
- Where WordPress stores your themes and plugins. WordPress存储主题和插件的位置。
- Where configuration files are stored on your WordPress install. 配置文件存储在WordPress安装中的位置。
This information also helps you learn 您应该备份哪些 WordPress 文件.
此信息还可以帮助您了解应该备份哪些 WordPress 文件 。
You will also be able to perform troubleshooting tasks like 停用所有 WordPress 插件, switching to a default theme, or fix other WordPress 常见错误.
您还将能够执行故障排除任务,例如停用所有 WordPress 插件 ,切换到默认主题或修复其他WordPress 常见错误 。
说到这里,我们来看看WordPress的文件和目录结构。
话虽如此,让我们看一下 WordPress 文件和目录结构。
访问WordPress文件和目录 (Accessing WordPress Files and Directories)
First, you will need a FTP客户端 to connect to your WordPress server. See our guide on 如何使用FTP上传WordPress文件 for detailed instructions.
首先,您将需要一个FTP客户端来连接到WordPress服务器。 有关详细说明,请参阅有关如何使用 FTP 上传 WordPress 文件指南。
An easier alternative to FTP is File Manager. It is a web based application that comes built into cPanel dashboard of your WordPress 托管 account.
FTP的更简单替代方法是文件管理器。 它是WordPress 托管帐户的cPanel仪表板内置的基于Web的应用程序。
使用 FTP 或文件管理器连接到 WordPress 站点后,您将看到如下所示的文件和目录结构:
使用 FTP 或文件管理器连接到 WordPress 站点后,您将看到如下文件和目录结构:

红色方块中的文件和文件夹是核心 WordPress 文件。这些是运行 WordPress 网站的文件和文件夹。您不应该自行编辑这些文件。
红场中的文件和文件夹是WordPress的核心文件。这些是运行 WordPress 网站的文件和文件夹。您不应该自己编辑这些文件。
以下是您将在 WordPress 网站根目录中看到的核心 WordPress 文件和文件夹的列表。
这是您将在 WordPress 网站的根目录中看到的核心 WordPress 文件和文件夹的列表。
- [dir] wp-admin [dir] wp-admin
- [dir] wp-includes [dir] wp-includes
- index.php index.php
- license.txt license.txt
- readme.html readme.html
- wp-activate.php wp-activate.php
- wp-blog-header.php wp-blog-header.php
- wp-comments-post.php wp-comments-post.php
- wp-config-sample.php wp-config-sample.php
- wp-cron.php wp-cron.php
- wp-links-opml.php wp-links-opml.php
- wp-load.php wp-load.php
- wp-login.php wp-login.php
- wp-mail.php wp-mail.php
- wp-settings.php wp-settings.php
- wp-signup.php wp-signup.php
- wp-trackback.php wp-trackback.php
- xmlrpc.php xmlrpc.php
WordPress配置文件 (WordPress Configuration Files)
您的 WordPress 根目录包含一些特殊的配置文件。这些文件包含特定于您的 WordPress 网站的重要设置。
您的 WordPress 根目录包含一些特殊的配置文件。这些文件包含特定于您的 WordPress 网站的重要设置。

- .htaccess – A server configuration file, WordPress uses it to manage .htaccess –服务器配置文件,WordPress使用它来管理永久链接 and 永久链接和重定向. 重定向 。
- wp-config.php – This file tells WordPress how to connect to your database. It also sets some global settings for your WordPress site.wp-config.php –该文件告诉WordPress如何连接到数据库。 它还为您的WordPress网站设置了一些全局设置。
- index.php – The index file basically loads and initializes all your WordPress files when a page is requested by a user. index.php –当用户请求页面时,索引文件基本上会加载并初始化所有WordPress文件。
有时您可能需要编辑 wp-config.php 或 .htaccess 文件。编辑这两个文件时要格外小心。一个轻微的错误可能会导致您的网站无法访问。编辑这两个文件时,请务必在进行任何更改之前在计算机上创建备份副本。
您有时可能需要编辑 wp-config.php 或 .htaccess 文件。编辑这两个文件时要格外小心。小错误可能会导致您的网站无法访问。编辑这两个文件时,请务必在进行任何更改之前在计算机上创建备份副本。
If you don’t see .htaccess file in your root directory, then checkout our guide on why you 找不到 .htaccess 文件 in your WordPress root directory.
如果您在根目录中没有看到.htaccess文件,请查阅我们的指南,了解为什么在WordPress根目录中未找到 .htaccess 文件 。
根据您的 WordPress 网站的设置方式,您的根目录中可能有也可能没有以下文件。
根据您的 WordPress 网站的设置方式,您的根目录中可能有也可能没有以下文件。
- robots.txt – Contains instructions for search engines crawlers robots.txt –包含搜索引擎抓取工具的说明
- Favicon.ico – A favicon file is sometimes generated by WordPress hosts. Favicon.ico –一个Favicon文件有时是由WordPress主机生成的。
内部wp-content文件夹 (Inside wp-content Folder)
WordPress 将所有上传、插件和主题存储在 wp-content 文件夹中。
WordPress 将所有上传、插件和主题存储在 wp-content 文件夹中。

通常假设您可以编辑 wp-content 文件夹中的文件和文件夹。然而,这并不完全正确。
通常假设您可以编辑 wp-content 文件夹中的文件和文件夹。然而,这并不完全正确。
让我们看一下 wp-content 文件夹,了解它的工作原理以及在这里可以做什么。
让我们看一下 wp-content 文件夹,了解它是如何工作的以及在这里可以做什么。

每个 WordPress 站点的 wp-content 文件夹的内容可能有所不同。但所有 WordPress 网站通常都有这些:
wp-content 文件夹的内容可能因 WordPress 站点而异。但所有 WordPress 网站通常都具有以下内容:
- [dir] themes [dir]主题
- [dir] plugins [dir]插件
- [dir] uploads [dir]个上传
- index.php index.php
WordPress stores your theme files in /wp-content/themes/
folder. You can edit a theme file, but it is generally not recommended. As soon as you update your theme to a newer version, your changes will be overwritten during the update.
WordPress将您的主题文件存储在/wp-content/themes/
文件夹中。 您可以编辑主题文件,但是通常不建议这样做。 将主题更新为较新的版本后,您的更改将在更新期间被覆盖。
This is why it is recommended to 创建一个子主题 for WordPress theme customization.
这就是为什么建议为WordPress主题自定义创建副主题的原因。
您在网站上下载并安装的所有 WordPress 插件都存储在 /wp-content/plugins/ 文件夹中。您不应该直接编辑插件文件,除非您只是为自己的 WordPress 网站编写插件。
您在网站上下载并安装的所有 WordPress 插件都存储在 /wp-content/plugins/ 文件夹中。除非您只是为自己的 WordPress 网站编写插件,否则不应直接编辑插件文件。
In many WordPress 教程, you will see code snippets that you can add to your WordPress site. The best way to add custom code to your WordPress site is by adding it to 函数.php file of your child theme or by creating a 特定于站点的插件.
在许多WordPress教程 ,您将看到可以添加到WordPress网站的代码段。 将自定义代码添加到WordPress网站的最好方法是将其添加到子主题的函数.php文件中,或者通过创建具体的于网站插件 。
WordPress stores all your image and media uploads in the /wp-content/uploads/
folder. By default, uploads are organized in /year/month/
folders. Whenever you are creating a WordPress backup, you should include uploads folder.
WordPress将所有图像和媒体上传/wp-content/uploads/
存储在/wp-content/uploads/
文件夹中。 默认情况下,上载在/year/month/
文件夹中。 每当创建WordPress备份时,都应包含uploads文件夹。
您可以从源下载 WordPress 核心、主题和已安装插件的新副本。但是,如果您丢失了上传文件夹,那么在没有备份的情况下将很难恢复它。
您可以从源下载 WordPress 核心、主题和已安装插件的新副本。但是,如果您丢失了上传文件夹,则在没有备份的情况下将很难恢复它。
您可能会在 wp-content 目录中看到一些其他默认文件夹。
您可能会在 wp-content 目录中看到一些其他默认文件夹。
- 非英语 WordPress 网站 in this folder.非英语 WordPress 网站语言文件存储在此文件夹中。
- 新版本当有新版本的时候创建的一个临时文件夹
Many WordPress plugins may also create their own folders inside your wp-content folder. For example, in the screenshot above we have a gallery folder created by 环境画廊 plugin.
许多WordPress插件还可能在wp-content文件夹内创建自己的文件夹。 例如,在上面的屏幕截图中,我们有一个由环境画廊插件创建的画廊文件夹。
其中一些文件夹可能包含重要文件。就像图库文件夹可能包含您的图库图像一样。您应该始终备份此类文件夹,以避免丢失重要数据。
其中一些文件夹可能包含重要文件。像图库这样的文件夹可能包含您的图库图像。您应该始终备份此类文件夹,以避免丢失重要数据。
Other folders may contain files that you can safely delete. For example your caching plugins like W3 总缓存 or WP超级缓存 may store cached files in their own folders.
其他文件夹可能包含可以安全删除的文件。 例如,您的缓存插件(例如W3 总缓存或WP超级缓存)可能会将缓存的文件存储在其自己的文件夹中。
That’s all, we hope this article helped you understand WordPress file and directory structure. You may also want to see our beginner’s guide to 使用 phpMyAdmin 管理 WordPress 数据库.
仅此而已,我们希望本文能帮助您了解WordPress文件和目录结构。 您可能还想查看我们的phpMyAdmin WordPress 数据库管理新手指南。
If you liked this article, then please subscribe to our YouTube 频道 for WordPress video tutorials. You can also find us on 推特 and Facebook.
如果您喜欢这篇文章,请订阅我们的YouTube 频道 WordPress视频教程。 您也可以在推特和Facebook上找到我们。
翻译自: https://www.wpbeginner.com/beginners-guide/beginners-guide-to-wordpress-file-and-directory-struct/
WordPress 目录结构