Comments screen in backend, how to disable Quick Edit | Edit | History | Spam | for non admins

This is done filtering the *_row_actions. For the Comments screen (/wp-admin/edit-comments.php) this is the hook: add_filter( ‘comment_row_actions’, ‘comments_row_wpse_92313’, 15, 2 ); function comments_row_wpse_92313( $actions, $comment ) { if( !current_user_can( ‘delete_plugins’ ) ) unset( $actions[‘quickedit’], $actions[‘edit’], $actions[‘spam’] ); return $actions; } I cannot see a History option, maybe it’s included by some plugin (?). It’s a … Read more

Can’t add default comments to custom post type

I figured this out after some searching. For anyone who wants to know: add_filter( ‘comments_open’, ‘my_comments_open’, 10, 2 ); function my_comments_open( $open, $post_id ) { $post = get_post( $post_id ); if ( ‘spark’ == $post->post_type ) $open = true; return $open; }

Exclude post_type from admin comments_list

You’ll need to filter comments_clauses, since WP_Comment_Query only supports a limited post type == X argument. /** * Exclude comments of the “foobar” post type. * * @param array $clauses * @param object $wp_comment_query * @return array */ function wpse_72210_comments_exclude_post_type( $clauses, $wp_comment_query ) { global $wpdb; if ( ! $clauses[‘join’] ) $clauses[‘join’] = “JOIN $wpdb->posts … Read more

“Leave a comment” link even when you can’t

In the loop.php template file, you will find this line: <span class=”comments-link”><?php comments_popup_link( __( ‘Leave a comment’, ‘twentyten’ ), __( ‘1 Comment’, ‘twentyten’ ), __( ‘% Comments’, ‘twentyten’ ) ); ?></span> If you don’t want “leave a comment” to display if comments are closed, you can wrap the call to comments_popup_link() in a if ( … Read more

how to make author to write comment on only his own posts?

I have the same thing running on my website. Here is how I do do it… Only post author and commentor can view each others comments function restrict_comments( $comments , $post_id ){ global $post; $user = wp_get_current_user(); if($post->post_author == $user->ID){ return $comments; } foreach($comments as $comment){ if( $comment->user_id == $user->ID || $post->post_author == $comment->user_id ){ … Read more

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