WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a plugin that needs to interogate the post preview (the contents of the rendered page that's presented when the user clicks "Preview Post".

To attempt to obtain this input stream into a code variable, I'm using wp_remote_get like so:

$response = 
$post->post_content = $response;

(I'm just replacing the post content with the results of the get for easy previewing during code testing).

My problem is that since I'm not passing any authentication parameters in the wp_remote_get, the preview action fails.

Is it possible to pass a parameter that authenticates the current user and returns the preview to the script?

share|improve this question
What info from the page plugin actually needs? I just wonder if it is possible to get rid of going through HTTP. – Rarst Nov 28 '10 at 16:11
Have you tried passing the cookie information? – Jan Fabry Nov 29 '10 at 16:13
up vote 1 down vote accepted

Have you checked out the following plugin?

share|improve this answer

Like Jan Fabry wrote, you need to pass the cookie information with the request. Basically that's the admins' login-cookie.

You can add those with the $args array parameter.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.