Viewing 2 replies - 1 through 2 (of 2 total)
  • $post = get_post($id);

    $post will hold the post object, where content is available through:

    $post->post_content

    Note: The argument must be a variable referencing the post ID as shown above. So you cannot use:

    $post = get_post('100');

    Also, if you’re putting this to use in a way that ends up whacking the default post ($post) object, you can use your own var:

    $mypost = get_post($id);

    Thread Starter Marcomail

    (@marcomail)

    thanks ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get global $post from ID’ is closed to new replies.