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

This is for a personal-use plugin I'm trying to make. I want to submit a comment from site A to my blog (sort of like sending trackbacks/pingbacks but a full comment).

For instance, on site A I have a form with a name, url, and comment field. The data I enter in site A, I want to submit to site B (my blog) via URL parameters or the POST method.

I assume that I'll need an action hook on my blog to retrieve data sent from site A and insert it in the wp comment table.

Is this possible?

share|improve this question
up vote 2 down vote accepted

Hi @wpStudent::

In WordPress, almost anything is possible. It all depends at times how hard you want to work for it. :)

The Comment Post form of course uses HTTP POST to submit to /wp-comments-post.php so you could use that except for the NONCEs if you want to post unfiltered HTML. You'd have to write a page to give you an acceptable NONCE which Site A would need to HTTP GET in order to be able to submit back to to the comment post form but I think if you don't mind the filters it should work fine.

Another option is to use a function designed for AJAX but have it capture your HTTP POST from your form and then save your comment to Site B by calling wp_insert_comment(). Or you could use AJAX on Site B to talk to Site A. Of course you'll be opening up a bit of a security hole by doing that, but if your code isn't distributed you can decide if that creates a real concern or not.

(Normally I would write up an example but have run out of time today. Hopefully the above sends you in the right direction.)

share|improve this answer
MikeSchinkel thank you for the reply! You definably put me on the right track :)I'll post an example soon and see if it's anything close to what you had in mind. – wpStudent Dec 24 '10 at 1:18

Ok I put together an example. I hope it will work :)

Passing data from site A to site B (the blog):

On site A I think I'll use the POST method, to send data to site B. I don't wan't to pass parameters in the url.

And on site B, I'll have

$name = $_POST['name'];
$email = $_POST['email'];
$url = $_POST['url'];
$content = $_POST['content'];
$time = current_time('mysql');

$data = array(
    'comment_author' => $name,
    'comment_author_email' => $email,
    'comment_author_url' => $url,
    'comment_content' => $content,
    'comment_date' => $time,
    'comment_approved' => 1,

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.