In the code below, I'm attempting to get a reference to the body content of the current post's fully rendered preview...
$response = wp_remote_retrieve_body(wp_remote_get('http://localhost/mysite/test-post/?preview=true&preview_id=28&preview_nonce=640bc54ca4')); $post->post_content = $response;
I'm just sending it to $post->post_content so that I can easily see it.
Here's part of what it returns...
<body id="error-page"> <p>You do not have permission to preview drafts.</p></body> </html>
I'm logged in as the administrator, so obviously I'm calling the preview wrong. How can I pass the URL in wp_remote_get to obtain the body section of the preview stream?
When I use...
$post->post_content = "<pre>".$response['body']."</pre>";