How would I count the number of times a comment meta field’s value is in a post’s entire comments?

You should be able to do a meta_query in a WP_Comment_Query(): $args = array( ‘post_id’ => ‘post-id-here’, ‘meta_query’ => array( array( ‘key’ => ‘fish’, ‘value’ => ‘shark’, ‘compare’ => ‘LIKE’ ) ) ); // Query the comments $comment_query = new WP_Comment_Query( $args ); // Count the number of comments $count = count ( $comment_query ); … Read more

WP_Comment_Query with 5 top level comments per page?

Updated The hierarchical parameter controls whether to include comment descendants in the comments results. From the inline docs we have that it accepts the following values: ‘threaded’ returns a tree, with each comment’s children stored in a children property on the WP_Comment object. ‘flat’ returns a flat array of found comments plus their children. false … Read more

How to put this result inside that result?

Run the loop in advance and populate an array, which in turn you include in the $result afterward. <?php // Create an empty array $comlistall = array(); foreach ( $comments as $comment ){ $comlistall[] = $comment; // <= Populate the array with the comments in the loop }; $rtitlez = get_the_title(); $rimgz = get_the_post_thumbnail_url(get_the_ID(), ‘full’); … Read more

Exclude comments from a WP_Query object?

Did you actually find a case where there are any real comments in the wp-query object after running a normal query? If you examine the code in class-wp-query.php, you should find that the comments field only is populated with comments when a “comments-feed” is being queried for. In normal operation, comments are not retrieved by … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)