How to get a value from comment meta

Looking at the Codex entry for get_comment_meta(), it appears that when the $single argument is set to TRUE (as you have done), the function returns a string. Try throwing an echo() into the works: <?php echo get_comment_meta( $comment->comment_ID, ‘country’, true ); ?>

Filter out comments with certain meta key/s in the admin backend

1. You can use pre_get_comments hook: add_action(‘pre_get_comments’, function($query) { global $pagenow; if ( is_admin() && (‘your-custom-page’ === $pagenow) ) { $query->query_vars[‘meta_query’] = [ ‘relation’ => ‘AND’, [ ‘key’ => ‘key1’, ‘value’ => ‘meta1’ ], [ ‘key’ => ‘key2’, ‘value’ => ‘meta2’ ] ]; } }); 2. You need to learn how to create an admin … Read more

How to customize WordPress twentytwelve_comment function

The quick answer would probably be ‘yes’ – although it is not recommended to customize a wordpress function directly a.k.a. “hack the core”. I would strongly recommend you use a child theme to override the comments template “comments.php” which is afaik the only template actually using the function twentytwelve_comment. You could then call your own … Read more

How can I get values count from wp_commentmeta?

Put the following function in your Theme’s functions.php and then put <?php echo tnc_reactions_count($post->ID); ?> in your single.php to output the numbers. Let me know if it works as I have not tested it completely. function tnc_reactions_count($post_id){ global $wpdb; $comments_table = $wpdb->prefix.’comments’; $commentsmeta_table = $wpdb->prefix.’commentmeta’; $get_post_comments = $wpdb->get_results( “SELECT * FROM $comments_table WHERE comment_post_ID=’$post_id'”, OBJECT … Read more

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