Exclude the word comment from being referenced

I found a solution to add rel=”nofollow” to comments. My theme maker gave me this hack that you can add in functions.php (no guarantee it will work for everyone, might depend on your theme): function add_nofollow_to_comments_popup_link() { return ‘ rel=”nofollow” ‘; } add_filter( ‘comments_popup_link_attributes’, ‘add_nofollow_to_comments_popup_link’ );

Comments on future posts

You can not enable comments in future posts. Those posts are not public and are not private, so they verify the conditional in line 61 of wp-comments-post.php file; that conditional is (WP 4.1.1): } elseif ( ! $status_obj->public && ! $status_obj->private ) { /** * Fires when a comment is attempted on a post in … Read more

Retrieve the last 5 comment URLs

If you mean, the last 5 comments on anything: $comments = get_comments( array( ‘count’ => 5 ) ); foreach( $comments as $comment ) { echo get_comment_link( $comment ); } For a specific post or page comments, just change the $comments line to: $comments = get_comments( array( ‘post_id’ => 1, ‘count’ => 5 ) ); // … Read more

Where are comments coded when using custom theme?

Generally comments are being displayed using comments.php, the template is rendered using a function called comments_template();. If- there is a comment template in your theme and it contains a function called comment_form(), and the comment template is being displayed below the post (in single.php, page.php etc.), and your comment settings from the Admin panel is … Read more

get_comment_link without pagination base in the returned URL?

It’s strange that you want to use comments pagination where the comment links are without the comments pagination base. But you can try this (untested): /** * Remove the comments pagination base from comments links */ ! is_admin() && add_filter( ‘get_comment_link’, function( $link, $comment, $args ) { if( $args[‘per_page’] ) $link = sprintf( “%s#comment-%d”, get_permalink( … Read more

‘comment_post’ hook doesn’t seem to work? [closed]

Does anyone know why this ‘comment_post’ hook doesn’t seem to work!? … When a comment is posted, the function is not triggered… at all? The hook works. Try the following, it works: add_action( ‘comment_post’, ‘test_notify’ ); function test_notify($args , $args2) { echo ‘It works!’; die; } As does this: add_action( ‘comment_post’, ‘test_notify’ ); function test_notify($args … Read more