Tag Info

Hot answers tagged

6

Pingbacks/Trackbacks: This is most likely a harmless case of link notifications to your blog (A) from the other blog (B), where: the comment_author_email field is usually empty, the comment_type field is either pingback or trackback, the comment_author field has the form: The title of the post that contains a link to a post of blog A | The site ...


6

You can try to modify it with the comment_form_defaults filter: /** * Modify the "must_log_in" string of the comment form. * * @see http://wordpress.stackexchange.com/a/170492/26350 */ add_filter( 'comment_form_defaults', function( $fields ) { $fields['must_log_in'] = sprintf( __( '<p class="must-log-in"> You must ...


5

You shouldn't copy that file, precisely because it is too bulky. About half of it is implementation of submission form, which was entirely replaced with comment_form() function around that time. So the answer why was it deprecated is roughly: Newer code is more compact Markup belongs in theme For better and more relevant comments.php example look at ...


4

The comment_notification_text filter is in wp-includes/pluggable.php in the wp_notify_postauthor function. You can copy and paste the $notify_message stuff and edit out what you don't want. function wpd_comment_notification_text( $notify_message, $comment_id ){ // get the current comment and post data $comment = get_comment( $comment_id ); $post ...


3

I wonder if you mean this kind of check: if( $comment->user_id > 0 ) { // Registered comment author } in your comment's template callback. This is determined in the the wp-comments-post.php file: $commentdata = compact('comment_post_ID', ..., 'user_ID' ); $comment_id = wp_new_comment( $commentdata ); but it's not obvious where the user_ID ...


3

Try this: if( get_comment_author() == get_comment_author_link() ) echo get_avatar( $comment, $size='75' ); else echo '<a href="' . get_comment_author_url . '">' . get_avatar( $comment, $size='75' ) . '</a>';


3

There is no need for a plugin. The reason people get this confused is because posts can have comments enabled or disabled on an individual basis. There is no "global" option, because it's per post. So really, it just takes two main steps to disable comments in WordPress: Settings > Discussion. Turn off both "Allow link notifications from other blogs ...


3

You should consider hooking into the comment_class() and post_class() filters, if your theme supports it. Using the comment_class filter: We can add the following filter: /** * Add a custom comment class, based on a given comment author's user meta field. * * @see http://wordpress.stackexchange.com/a/170443/26350 */ add_filter( 'comment_class', ...


3

I skimmed through the source of the wp_notify_postauthor() function and noticed the comment_notification_recipients filter. I wonder if you could simplify your plugin to the following code snippet: <?php /** * Plugin Name: Disable comment/trackback/pingback notifications emails * Plugin URI: http://wordpress.stackexchange.com/a/150141/26350 */ ...


3

There is definitely a performance advantage in keeping your comment spam to a minimum. If you have a lot of comments, the query time can get pretty out of control. To make it easier, you should install Akismet if you haven't already. Akismet will automatically detect spam comments and move them to WordPress spam section. You can then delete all the spam ...


2

This can be done, there is even a possibility to control this via the backend, just go to: → Settings → Discussion And there under: → Other comment settings You have the point: → Enable threaded (nested) comments | X | levels deep


2

After reading a bit on regex and preg, starting from a previous example of a similar problem and testing it I was able to answer my own question. I added this function to functions.php: <?php /** Plugin Name: WPSE (#167237) Redirect after comment */ add_filter('comment_post_redirect', 'redirect_after_comment'); function ...


2

The plugin you mentioned is only a single function so it shouldn't be too heavy on your setup. It uses the comments_template filter to inject the pingbacks/trackbacks list into your page. But the plugin is using an extra manual SQL query and the template is constructed by hand, so there's a room for improvements/simplifications. A simple demo plugin with ...


2

You can use the get_comment_author_link hook, which is part of the get_comment_author_link() template tag, like your question already suggests. Then you only have to get the according user_id, which can be done via the $comment global, and construct the link you want accordingly. Exemplary usage like shown below: add_filter( 'get_comment_author_link', ...


2

You can try to replace if ($current_user->ID == $post_data->post_author) { with if ( $current_user->ID == $post_data->post_author || $current_user->has_cap( 'manage_options' ) ) { to additionally allow users, with the correct capability, to vote for the best comment.


2

You can use a filter to pre_get_posts so that only your posts are listed. Something like this: function my_posts_only( $query ) { global $pagenow; if ( 'edit.php' != $pagenow || ! $query->is_admin ) return $query; if ( ! current_user_can( 'manage_options' ) ) { global $user_ID; $query->set( 'author', $user_ID ); ...


2

This is possible using the comment_post action, and the GFAPI class which handles entries in WordPress. What you need to first is add using comment_form_default_fields a field which is a checkbox. function add_to_email_list_field($fields) { $fields['add-to-email'] = '<p class="comment-form-public"> <input id="addtoemail" ...


2

Look at the function wp_delete_comment(). It fires an action before the comment is deleted: /** * Fires immediately before a comment is deleted from the database. * * @since 1.2.0 * * @param int $comment_id The comment ID. */ do_action( 'delete_comment', $comment_id ); … and one after deletion: /** * Fires immediately after a comment is deleted ...


2

So after some time I done exactly what I wanted and I thought it would be nice to share. So in functions.php add function c_parent_comment_counter($pid,$uid){ global $wpdb; $query = "SELECT COUNT(comment_post_id) AS count FROM $wpdb->comments WHERE <code>comment_approved</code> = 1 AND <code>comment_post_ID</code> = $pid ...


2

wp_update_comment triggers the edit_comment action (source), you're creating an infinite loop.


2

You could try to count the number of unique comment author emails per post: /** * Number of unique comment author emails per post: * * @see http://wordpress.stackexchange.com/a/168606/26350 * @param int $pid * @return int */ function get_unique_commenters_by_post_id( $post_id ) { global $wpdb; $sql = "SELECT COUNT(1) as uc FROM ( ...


2

When you are editing the post or page. You can disable comments from the "Discussion" box. By default this box is hidden. Show the Discussion meta box If you don't see a box labeled Discussion: Open the Screen Options by clicking the tab near the upper right-hand corner of the screen with the name Screen Options. Check the checkbox before Discussion. ...


2

The wp_list_comments() function uses the HTML comment list class Walker_Comment by default: A single comment is then displayed with the Walker_Comment::comment() method (#source). If the comment format is HTML5 then the Walker_Comment::html5_comment() is used instead (#source). The pingbacks are rendered with the Walker_Comment::ping() method (#source). ...


2

parent : Comments can be replies to other comments. Every comment has an ID number. When the comment is a reply, then it will have a "parent" which is the ID of the comment it is replying to. Putting a comment ID in here will get all the replies to that comment. post_parent : Posts can be children of other posts as well. This is how things like hierarchical ...


1

Luckily, I was able to solve this. The problem was in #comments ul li p, so I deleted the margin and text-align properties from there, which were conflicting with the reply comment form, and modified other parts of the css file to achieve the same result. The solution might vary in other cases, but I hope this would help as a guide! This is the modified ...


1

The comments_open() function is used, both by core and typically themes to determine status for specific post. It has filter of same name for result, which you can use to manipulate it individually for the post. comment_form() won't actually output form if check is false and fire comment_form_comments_closed action in such case. Native WP themes, shipped ...


1

Try this Solution.This will surely helps you. Replace your wp-includes and wp-admin folder with WordPress's core folder from WordPress package. May be you have problem with uploading these two folders and this may lead you that problem.


1

Yes, of course it won't show any name for guest comments because they are not registered users of your website so they don't have any nickname associated. What you can do in this situation, is add a check before printing the nickname, if comment was made by a user or a guest. And act accordingly. So this is the code you want to use instead. if ( ...


1

Found it!!! Pages -> Quick Edit -> untick Allow Comments


1

Finally I found a bug in CPT UI plugin. There is no rewrite_rules apply at edit form submit stage. To have rewrite_rules finally applied, I have to show "edit post type" form (without submitting it) to have edited properties actually applied. I've also described an issue in WP blog. ...



Only top voted, non community-wiki answers of a minimum length are eligible