• The following test code was working fine up to 2.3.3 but when I upgraded to 2.5 it stopped working. Specifically, it returns nothing, meaning there are no errors but no posts come back either, when it should display titles of the posts!

    <?php
    require('wp-blog-header.php');
    if (have_posts()) : while (have_posts()) : the_post();
    the_title();
    endwhile; else:
    endif;
    ?>

    I don’t know what happened since there are no errors coming back!!!

Viewing 1 replies (of 1 total)
  • Thread Starter Jeff Sherk

    (@jsherk)

    Okay, just so I know I’m not crazy, try this piece of code:

    <?php
    require('wp-blog-header.php');
    $myid=10; //put a post id here that you know is valid
    $mytest = get_post($myid);
    echo "Known good post id ".$myid." returns: ".$mytest->post_title;
    $mytest = have_posts();
    if ($mytest=="") { $mytest="nothing"; }
    echo " and have_posts() returns: ".$mytest;
    ?>

    If you stick a Post ID number in that you know is valid, it will correctly display the title, yet the have_posts() returns empty!

    Any suggestions anybody?

Viewing 1 replies (of 1 total)
  • The topic ‘problem with wp-blog-header or have_posts?’ is closed to new replies.