submit_comment not working
-
I have been working with this API to fetch posts and comments OK, but now I want to submit a comment using the submit_comment API.
I’ve activated it in the settings and written a test post as follows.$.ajax({
type: “POST”,
url: app.siteURL + “/submit_comment”,
data: {
‘post_id’ : ‘9’,
‘name’: ‘Mr Comment’,
’email’: ‘valid email address’,
‘comment’: ‘A test Ajax post’
},
success: function(response){
console.log(‘success:’);
},
error: function(){
console.log(‘submit_comment failed’);
},
complete: function(){
console.log(‘complete’);
}Where I’ve put ‘valid email address’ I’ve obviously used a real one, just not posting an email address here.
I see the hit on my test Apache server, and I see the ‘success’ and ‘complete’ console messages, but no comment appears in WordPress.
The Post ID is valid, and open to posts, I’ve changed WordPress settings to allow anyone to post, but still I don’t see anything, or any errors.
I can see the php script that get called, but can’t see how the json api interacts with WordPress itself, and can’t see any errors.
Has anyone else got this working?
- The topic ‘submit_comment not working’ is closed to new replies.