• Steven

    (@spstieng)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • stvwlf

    (@stvwlf)

    do a var_dump to see what is going on

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

    var_dump($thePost);

    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘post_content not working for get_post()’ is closed to new replies.