An update. I have sort of figured out an awful hack to get data within the ‘comment_type’ field via ‘wp-comments-post.php’, and I would surely appreciate any suggestions to streamline this hack, and get it out of ‘wp-comments-post.php’. What I did was add the following code, and commented out the following code in wp-comments-post.php.
// User Added Code
$comment_type = ( isset($_POST['comment_type']) ) ? trim($_POST['comment_type']) : null;
// User commented code!
//$comment_type = '';
And this works, however, it wont as soon as I update WordPress, if I update WordPress. I would ‘love’ to run this within functions.php, however, I do not know how to initiate a function in functions.php “after” wp-comments-posts.php has done its thing, otherwise, I would not be asking for help. Again, I appreciate any guidance that anybody would be will to lend me. Thanks in advance.
(@justinbyrne001)
13 years, 1 month ago
Currently I am developing my own custom WordPress theme, and I am having an issue with posting comments. Here is my code for my comment area, or the area where my guests can post their comments:
Now my issue is with ‘comment_parent’. For whatever reason I am unable to post the ‘comment_parent’ field within wp_comments via this method. Whenever I post a comment within wp_comments, the comment_parent field automatically defaults to zero, regardless of how it is set. Currently I have a js function that changes the ‘0’ value that you see above to a ‘1’, and after I submit a comment ‘0’ is always placed within comment_parent. In addition, I am unable to post anything to ‘comment_type’ either, which I would like to do if I want to pull off what I am attempting to do.
Ultimately, I am attempting to see if anybody out there is able to help me to understand ‘how’ to post to both ‘comment_parent’, and ‘comment_type’ within the ‘wp_comments’ table within the WordPress DB via a <form>. Thanks in advance.