• Is there a way to create a comment using the API that is set to approved status? The comment documentation for WordPress API is lacking in what the actual values for status are. So far, we have tried setting:

    status: approve – didn’t work. It still shows as pending in the dashboard.
    status: approved – didn’t work. It still shows as pending in the dashboard.

    Oddly, we can create the comment using
    status: hold

    and then go back in via Postman and upate status to approve and then it moves out of pending status. But we want to create it in approved status without having to do an additional update.

    any help is much appreciated.

    –Sean

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    ‘approve’, ‘approved’, or 1 should all work, provided the authentication you use allows any status be specified. It’s a protected parameter. I suspect an issue with you authentication method. Have you tried an authentication password set for an administrator user? (or another user with ‘moderate_comments’ capability)

    It looks like you can override default behavior through the “rest_after_insert_comment” action. From the added callback execute wp_set_comment_status( $comment->comment_ID, 'approve' );
    after verifying current user capability. Untested though.

Viewing 1 replies (of 1 total)
  • The topic ‘Creating an approved comment via API’ is closed to new replies.