Answers for "display only user contributor comments wordpress"

0

display only user contributor comments wordpress

// 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');
}
Posted by: Guest on February-16-2021

Code answers related to "display only user contributor comments wordpress"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language