The comment could not be saved. No comment_ID on comments

I had the same problem and it was indeed solved by turning on Auto_Increment (A_I) for “comment_ID”. Here’s how to do that: https://stackoverflow.com/questions/5665571/auto-increment-in-phpmyadmin In my case, “comment_ID” was not set as a Primary Key and I received an error (1075). It was easily fixed by assigning a Primary Key to “comment_ID”. See this: https://stackoverflow.com/questions/19198397/mysql-how-to-set-the-primary-key-on-phpmyadmin

how to SELECT for the current post id?

You should be able to do that by joining data from wp_comments table as this table contains information about which comments belong to which posts $sql = $wpdb->prepare( ” SELECT meta_value FROM {$wpdb->prefix}commentmeta INNER JOIN {$wpdb->prefix}comments ON {$wpdb->prefix}commentmeta.comment_id = {$wpdb->prefix}comments.comment_ID WHERE comment_post_ID = %d AND meta_key = ‘rating’ “, get_the_ID() ); $results = $wpdb->get_results( $sql … Read more

Moving post’s content to post’s comments section

Most CMS migration/data import tools for WordPress rely on some degree of access to the original data types and store – e.g. the discrete data related to posts, authors, and comments – which can then be fairly directly translated to WordPress’s counterparts. This particular case is considerably more involved since comments and authors have been … Read more

Pending Comments

get_comments() will get comments for you, either from all across a blog or for a specific post. Its arguments are documented at WP_Comment_Query::__construct(). Unless you’ve installed a plugin that adds pending as a comment status, you’re probably looking for something like this: $args = array( // Limits comments to a specific post. // Leave this … Read more

Comment System showing different type of IP

This look like a valid IPv6 that uses 128 bit addresses, instead of the older 32 bit addresses of IPv4 that have already been exhausted. Here’s a schema picture of an IPv6 address from Wikipedia: Even though the IP address is valid, it’s another matter if the comment is a spam or not. I assume … Read more

I can’t post comment via REST API

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: add_action(‘rest_api_init’, function () { register_rest_route( ‘api’, ‘api_post_comment’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘api_post_comment’, ) ); }); function api_post_comment() { wp_insert_comment([ ‘comment_approved’ => 0, ‘comment_author’ => ‘test’, ‘comment_author_email’ => … Read more

Comments change the template name

That comment is what makes a file as a (custom) page template. Relevant excerpt from Creating Custom Page Templates for Global Use: To create a global template, write an opening PHP comment at the top of the file that states the template’s name. <?php /* Template Name: Example Template */ ?> And the tutorial actually … Read more

How to customize the title from comments form?

it depends on the theme, but in general Comments are generated by the template : comments.php , you found something like that (example) : <?php $dro_pizza_comment_count = get_comments_number(); if ( ‘1’ === $dro_pizza_comment_count ) { printf( /* translators: 1: title. */ esc_html__( ‘One thought on &ldquo;%1$s&rdquo;’, ‘dro-pizza’ ),'<span>’ . esc_html( get_the_title() ) . ‘</span>’ ); … Read more

Add a Comment on/off option in Screen Options for Comments?

To achieve this, you should filter the manage_edit-comments_columns filter to remove the core comment column, and add a custom comment column so the checkbox shows up in the screen options tab. For the output of comments, you would then need to get comment_content from the comment for display output in the manage_comments_custom_column hook. This is … Read more