wordpress - 我在 WordPress 中哪里可以找到我所有帖子/文章的目录?

标签 wordpress directory file-structure

我认为所有帖子都应该在 wp-content/uploads/... 但我找不到它们。有人知道我的帖子在哪里吗?谢谢!

最佳答案

当您说“帖子”时,您指的是默认帖子类型“帖子”(管理面板中的帖子选项卡)吗?

如果这就是您所指的,您可以直接通过数据库访问它们。所有帖子都存储在您的数据库中,而不是作为实际文件。

如果您需要通过模板访问它们,您可以使用两种 WordPress 方法之一:

$args = array(
    'post_type' => 'post
);

args 数组将是您的查询设置。

$posts = get_posts($args);
print_r($posts); // this will give you 5 posts, you can increase the number with the argument 'posts_per_page' => x

您可以使用简单的 foreach 循环访问这些数据。

第二种方法:

$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
    while ( $the_query->have_posts() ) {
         //post data (title, content, etc...)
    }
}

关于wordpress - 我在 WordPress 中哪里可以找到我所有帖子/文章的目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42590267/

相关文章:

css - 无法在 WordPress 主题中设置自定义 CSS

WordPress - 通过自动更新强化权限?

javascript - Ionic/Angular JS - 用于从 wordpress api 中提取的复选框项目的 ng-storage

php - 如何[递归地]压缩PHP中的目录?

将文件从一个包含大量文件的目录移动到一个月文件夹的 Bash 脚本

wordpress - 如何在 Apache 上使用 Wordpress 控制 Cache-Control header ?

Pythonic 方式查找给定名称最接近特定目录位置的文件

command-line - 批处理脚本 - 更改桌面上文件夹的图标 (Windows XP)

visual-studio - Emacs 作为 IDE : Handling a project directory?