How to make comment text field un-required?

You can circumvent the check for empty comments easily by adding the uploaded image as HTML to the comment text: add_action( ‘pre_comment_on_post’, ‘allow_empty_comment_text’ ); function allow_empty_comment_text( $text=”” ) { if ( ! isset ( $_POST[‘comment’] ) or ” === trim( $_POST[‘comment’] ) ) { $img = ‘/* Process uploaded image here, create an <img> tag. … Read more

Add delete, approve, spam Links to Comments

Per default wp_list_comments() calls the class Walker_Comment. Its method start_el() calls edit_comment_link() and here we find a filter for your question: It is called ‘edit_comment_link’ and it passes two variables, the link text and the comment ID, which we can use. The URLs to mark a comment as spam or to delete it are: wp-admin/comment.php?c=1&action=cdc&dt=spam … Read more

Average Score of all ratings in comments

add this code into your plugin file to register activation hook // register activation hook register_activation_hook( __FILE__, ‘my_rating_plugin_activation’ ); now create a function and add your table creation code into function my_rating_plugin_activation() { global $wpdb, $rating_table_name; if($wpdb->get_var(“SHOW TABLES LIKE \”$rating_table_name\””) != $rating_table_name) { $wpdb->query(“CREATE TABLE IF NOT EXISTS $rating_table_name ( rating_id int(11) NOT NULL AUTO_INCREMENT, … Read more

Change allowed HTML tags for comments

You are changing the $allowedtags too late. On the last line, add_filter should be called for pre_comment_content instead of comment_post, and also, use different priority, something like this: add_filter(‘pre_comment_content’, ‘custom_allowed_tags_comment’, 9);

Enable Recent Comments widget to display comments on attachment posts

you can use the widget_comments_args filter to modify the default args of the recent comments widget: function wpse80087_widget_comments_args( $args ) { $args = array( ‘number’ => 5, ‘post_type’ => ‘attachment’, ‘status’ => ‘approve’, ‘post_status’ => ‘inherit’ ); return $args; } add_filter( ‘widget_comments_args’, ‘wpse80087_widget_comments_args’, 10, 1 );

Comments enabled, but disabled at the same time

You can try the following function: function enable_comments() { update_option( ‘default_comment_status’, ‘open’ ); } add_action( ‘after_setup_theme’, ‘enable_comments’ ); This should enable comments for all new posts. On the other hand have you checked your theme? Some themes for some reasons have build in functions that overrides the default WP comments behavior.

Get number of comments after modifying comment query

Refrain from editing core files WordPress was developed with extensibility in mind, and provides many ways to change the appearance and functionality of an installation without altering the WordPress software itself (mostly using Hooks in conjunction with Plugins and Themes). The software is comprised of it’s “core files”, which are generally everything outside of the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)