简体   繁体   中英

WordPress: Can't get posts

I am trying to get posts using the following code:

<?php
wp_reset_query();
if ( have_posts() ) {

while ( have_posts() ) {

    the_post(); ?>

    <h2><?php the_title(); ?></h2>

    <?php}
}
?>

But nothing is displayed and if I do a var_dump on the_post() am still getting null. Ps: I've created two posts on the wp-admin panel means that they really exist in the db.

我不知道真正发生了什么,但是我通过删除之前创建的所有页面并再次创建它们来解决了该问题……现在,一切正常。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM