display only user contributor comments wordpress

The solution for “display only user contributor comments wordpress” can be found here. The following code will assist you in solving the problem.

// Add to functions.php
function authorize_comments_for_current_user($clauses) {
if (is_admin()) {
global $user_ID, $wpdb;
$clauses[‘join’] = “, wp_posts”;
$clauses[‘where’] .= ” AND wp_posts.post_author = “.$user_ID.” AND wp_comments.comment_post_ID = wp_posts.ID”;
};
return $clauses;
};
if(!current_user_can(‘edit_others_posts’)) {
add_filter(‘comments_clauses’, ‘authorize_comments_for_current_user’);
}

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in