I try to insert comment via REST API , but i get this error :

Query parameter not permitted: author

I followed this docs and author is one of the arguments this is the link test that i use


So, what i am doing wrong ?

  • 1
    Creating comments via the REST API requires authentication, and the authenticated user also needs the edit_posts capability - i.e. permissions to edit posts - in order to use the author parameter.
    – Sally CJ
    Sep 13, 2019 at 0:50

1 Answer 1


I do not recommend doing this. It's better if you authenticate your users, but you can make an api endpoint that posts a comment like this:

    function () {
            'methods'  => 'GET',
            'callback' => 'api_post_comment',

function api_post_comment() {
        'comment_approved' => 0,
        'comment_author' => 'test',
        'comment_author_email' => '[email protected]',
        'comment_author_IP' => $_SERVER['REMOTE_ADDR'],
        'comment_content' => 'test',
        'comment_parent' => 0,
        'comment_post_ID' => 25084,

You can learn more here: https://developer.wordpress.org/reference/functions/wp_insert_comment/

and here: https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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