Limited Support
Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed.
We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.
I want to post a new comment from react native app using: POST /wp/v2/comments
When I add a comment like that, wpdiscuz_votes_separate and wpdiscuz_votes fields don't get created in commentmeta table at that point. They get created when I click on + or - on comment on the website. But I need it to be created immediately because I have to parse wpdiscuz_votes_separate value in order to show the the number of likes and dislikes, and also to be able to update them on the mobile app. I am updating them via endpoint in function.php file.
Can those rows be created with the creation of the comment somehow?
I handled it when posting new comment from my mobile app by adding
add_action("rest_insert_comment", function ($comment, $request, $creating) { add_comment_meta($comment->comment_ID, 'wpdiscuz_votes_seperate', ["like" => 0, "dislike" => 0]); add_comment_meta($comment->comment_ID, 'wpdiscuz_votes', 0); }, 10, 3);
to functions.php in my theme.
It adds these two fields to commentmeta table every time a new comment is created.
But it doesn't add these fields when I create a new comment on the website.
Can I add
add_comment_meta($commentId, self::META_KEY_VOTES, 0); add_comment_meta($commentId, self::META_KEY_VOTES_SEPARATE, ["like" => 0, "dislike" => 0]);
somewhere in addComment function in WpdiscuzCore.php ?