我认为所有帖子都应该在 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/