Forums

post_content not working for get_post() (3 posts)

  1. spstieng
    Member
    Posted 2 years ago #

    This is the code I use, and the result i s blank:

    $postID = 15;
    $thePost = get_post($postID);
    echo $thePost->post_content;

    If I change post_content to post_title, it ouputs the title.

  2. stvwlf
    Member
    Posted 2 years ago #

    do a var_dump to see what is going on

    $postID = 15;
    $thePost = get_post($postID);
    echo $thePost->post_content;

    var_dump($thePost);

  3. okcancel
    Member
    Posted 2 years ago #

    your original code worked for me:

    $postID = 2;
    $thePost = get_post($postID);
    echo $thePost->post_content;

    but instead of calling up post 2, it called up page 2. i give my posts slug names; is there a way to call up by post name instead of postID?

Topic Closed

This topic has been closed to new replies.

About this Topic