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


5

To answer your first question: »How does WooCommerce add the comment_type of order_note to the dropdown in Comment Administration?«. From woocommerce-admin-init.php: function woocommerce_admin_comment_types_dropdown( $types ) { $types['order_note'] = __( 'Order notes', 'woocommerce' ); return $types; } add_filter( 'admin_comment_types_dropdown', ...


5

I would enable comments for that page and save them with a comment meta holding your object's ID. To be more specific, this is how would I tackle this issue: Hook into comment_post action and save a comment meta called my_object_id with your custom object ID as a value when posting a comment from the relevant page. To display only relevant comments, I'd ...


4

Preface Once post preview is frontend, the comment form depends on how theme handle it. I will assume in this answer that the comment form is shown using the standard comment_form() function. The previous assumption isn't enough, in fact comment_form is probably the function in WordPress core with more hooks. There is almost an hook for every line. So what ...


4

When we post an empty anonymous reply, we get the following errors: The part of BBPress that's responsible for handling this, is the bbp_new_reply_handler() function, in the file /bbpress/includes/replies/functions.php. It contains these lines that are of interest to us: // User is anonymous if ( bbp_is_anonymous() ) { // Filter ...


3

wp_insert_comment() is low level function, it only saves passed data without concern for what it contains. If you are looking to replicate sanitizing WP does on comment data (totally good idea :) you are probably looking for higher level wp_new_comment().


2

Yes, alter the single-debate.php and call a custom comment template using comment_template with a parameter, representing your custom comment template. <?php // If comments are open or we have at least one comment, load up the comment template if ( comments_open() || '0' != get_comments_number() ) comments_template('custom-comments.php'); ?>


2

You don't need a form to submit a comment to the wp-comments-post.php file, or to send a pingback or trackback. Spammers don't use forms, they simply send their spam directly. Removing the form doesn't "turn off" comments. To do that, go to the Posts screen, and use the Quick Edit to actually disable comments and trackbacks for the various posts. Also visit ...


2

Debug ideas: You could try to see if this has any effect: add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' ); But you should check out the parameters that go through the bp_core_fetch_avatar filter to see if they are correct (untested): add_filter( 'bp_core_fetch_avatar', 'my_bp_core_fetch_avatar', 99, 9 ); function my_bp_core_fetch_avatar( ...


2

In the default usage this is impossible due to the nature of the default comment walker which always directly outputs. But the function allows to provide a custom walker. Further reading about custom walkers: Codex Class reference example custom walker class You could also use output buffering to save it into a variable (this is considered to be dirty): ...


2

When it comes to retrieve posts, it's supposed to call WP_Query. WP_Query has an argument called meta_query but it doesn't have comment_query. So it might need a trick to achieve what you want, $args = array(); $args['feed'] = 1; $args['withcomments'] = 1; $args['author'] = 1; //author id. $query = new WP_Query($args); $posts = $query->posts; //do what ...


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 WP_Query <?php $paged = get_query_var('paged') ? get_query_var('paged') : 1; $args = array( 'post_type' => 'letters', 'posts_per_page' => 10, 'paged' => $paged, 'meta_key' => 'letter_show_on_site', 'meta_value' => "yes" ); $the_query = new WP_Query($args); if( $the_query->have_posts()){ ...


2

You have no need for three states. Logically, you have "set" and "unset". Don't complicate things. When you check the box, add p3_comment_status. When you uncheck, remove (delete) the key. If you do that, all you need to do is use EXISTS/NOT EXISTS. That makes for a much simpler, and faster, query as a bonus. You have not posted the code that saves your ...


2

There is a plugin with that readers can post comments inline, like in Microsoft Word. The WordPress plugin bases on inlineDisqussions by Tsi and is called Inline Comments: http://wordpress.org/plugins/inline-comments/ Inline Comments adds the great Disqus Comment System to the side of paragraphs and other specific sections (like headlines and images) of ...


2

Well, this is partly true and partly false. When you trash a post, everything that is tied to it is also trashed. This means, if you untrash the post, the comments etc. are untrashed as well. However, comments and other stuff is not handled as if they were trashed directly (i.e., on the Comments page in your WordPress Admin). If you directly trash a ...


2

This can be used, mainly by plugins, to add some additional information to a comment. By having one generic table you don't need to add columns to wp_comment for every additional piece of data. E.g. a plugin could add a rating to each comment and store that value in wp_commentmeta.


2

That table is essentially the same as for all of the other "meta" tables in the WordPress architecture. It holds misc. bits of extra, usually optional, information about the associated post, user, or in this case comment. You can store whatever information you need to add to a comment-- perhaps a plugin wants to implement "abuse" flags, or comment upvotes. ...


2

wp_list_comments() accepts a walker in the array of its first parameter. This is a class that renders the output. If you don’t provide one, the default class will be used, Walker_Comment. You can find it in wp-includes/comment-template.php. To change the complete comment list out, create a custom walker in your functions.php which extends the default class: ...


2

You can try the gettext filter. According to the Codex: This filter hook is applied to the translated text by the internationalization functions (__(), _e(), _x(), etc.). This filter is always applied even if internationalization is not in effect, and if the text domain has not been loaded. Here's an example: function custom_gettext( ...


2

You are using comments_template which prints out the comments and returns nothing you need to capture the comments template so try this: function get_comments_template(){ ob_start(); comments_template(); return ob_get_clean(); } and change this line: $result .= comments_template(); //Append the comments template to the result to $result ...


2

Basically it's just a request using the WP HTTP API using its functions. Something along the lines of: $response = wp_remote_get( $disqusURLwithArgs, array( /* API args */ ) ); // Additional checks like wp_remote_retrieve_resonse_code // or wp_remote_retrieve_response_message // and is_wp_error( $response ) $content = wp_remote_retrieve_body( $response ); ...


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

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


1

You can use this SQL query to approve all spam comments: UPDATE wp_comments SET comment_approved = 1 WHERE comment_approved = 'spam';


1

Could be as simple as using the full function in the template file: <?php comments_template( '', true ); ?> Be sure you have a comments.php file in the theme folder. And be sure you're using the full loop: <?php require('/the/path/to/your/wp-blog-header.php'); ?> <?php $posts = ...


1

If you want to add some custom HTML between the </h3> and the <form> tags, you can try the following: /** * Add custom HTML between the `</h3>` and the `<form>` tags in the comment_form() output. */ add_action( 'comment_form_before', function(){ add_filter( 'pre_option_comment_registration', 'wpse_156112' ); }); function ...


1

The ability to set comment status is tied to the "edit_comment" capability, which is a meta-capability in WordPress. It maps to the "edit_post" capability, which is another meta-capability that varies depending on whether a post is published or not. In the end, if a post is published, then edit_comment ends up mapping to "edit_published_posts" for the ...



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