Hide comments from admin comments.php that user can’t edit or manage

I found another piece of code on the internet which I have modified to work. add_filter(‘the_comments’, ‘edit_comments_filter_comments’); function edit_comments_filter_comments($comments){ global $pagenow; $currentuserid = get_current_user_id(); if($pagenow == ‘edit-comments.php’ && !current_user_can(‘edit_others_posts’)){ foreach($comments as $i => $comment){ $the_post = get_post($comment->comment_post_ID); if($comment->user_id != $currentuserid && $the_post->post_author != $currentuserid) unset($comments[$i]); } } return $comments; } As I understand it, this … Read more

comments_template() doesn’t work with ajax call

I partially resolved adding this code: $args = json_decode( stripslashes( $_POST[‘query_vars’] ), true ); $args[‘paged’] = $_POST[‘page’]; //Set Query Post args query_posts( $args ); //Set Glboal Post Data global $post; $post = get_post( $_POST[‘post_id’] ); setup_postdata( $post ); //Set global $withcomment = true to execute comments_template() – using comments-ajax.php Template (Root Folder Theme) global $withcomments; … Read more

Remove rel=”nofollow ugc” from links in comments

This removes the tag before it displays the comment on the page. I tested it myself. function remove_ugc_from_links($text) { // replace ‘rel=”ugc”‘ with an empty string $new_text = str_replace(‘rel=”ugc”‘, ”, $text); return $new_text; } // Hook our function to the ‘comment_text’ filter add_filter( ‘comment_text’, ‘remove_ugc_from_links’);

Pre_get_comments and orderby comment_karma

I think you’re close with your 2nd snippet, but you should be using meta_value_num instead of meta_key_num. $query->set( ‘meta_key’, ‘comment_karma’ ); $query->set( ‘orderby’, ‘meta_value_num’ ); See the WP_Query orderby docs for more info.

Remove rel=”ugc” from links in comments

The rel=ugc is added by a default filter on pre_comment_content. You can disable this by adding the following line to your functions.php: remove_filter (‘pre_comment_content’, ‘wp_rel_ugc’, 20); This may not be wise. If at some point you change your mind, you would have to go through all comments to add it. It is problably better to … Read more

How to add embed image in comments?

You can do that by using the comment_text filter. It runs for each comment, so with some regex you can find all links in the comment and loop through them. You make one more check to make sure the link has an image extension (jpg, jpeg, png, etc). If it does, we can embed it … Read more

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino