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

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 ...


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 */ ...


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

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

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

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

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

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 ...


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

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

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 ...


1

Actually this is what you need to use. <?php echo get_comment_meta( $comment->comment_ID, 'rating', $rating ); ?> IDs are already stored in $comment array.


1

oh, it looks like I wrote that script, so let me try to answer you ;-) You could for example: add your own action hook in your template, use javascript to move the pings below the Disqus comments, hijack the disqus_language_filter filter of the Disqus plugin. If you go for the last option, you could use this modification of the PingsList class ...


1

You can try the comment_text filter: /** * Prepend text to each comment content. */ add_filter( 'comment_text', function( $comment_text ) { $text = 'Some text'; return $text . $comment_text; }); if you're displaying the comment text with: <?php comment_text(); ?>


1

Three aspects to this: Adding the checkboxes to the comment form Adding the values from the checkboxes to the comment meta data Displaying the values of the checkboxes Assuming you want to dynamically generate these based on the headings in the article, you'll need to parse the post content for headings and add the checkboxes to the comment form. This ...


1

Go to yoursite... /wp-admin/options-discussion.php Is Users must be registered and logged in to comment selected? If so, unselect it and Save Changes.


1

Well, that "link back" might be a Trackback or Pingback. It´s a function to inform other blogs that you have "used", mentioned or linked to their content. It´s made for connecting blogs with each other. Some themes show Track-/Pingbacks in the comment section, some don´t. Anyway, if you want to disable them, you can do so under Settings -> Discussion -> ...


1

Easiest way to handle hiding the display is to use css. Your "reply to" form is probably displayed inside of a comment div or has some class identifying it as a comment reply. You still might need to handle the check on the server side to make the rating field to be not required when a comment has a parent comment.



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