How to not load comments form on post preview?

I took a quick peek at the disqus plugin. This works in disabling the option before the plugin decides to print out the form. add_filter( ‘pre_option_disqus_active’, ‘wpse_conditional_disqus_load’ ); function wpse_conditional_disqus_load( $disqus_active ) { if( is_preview() ){ return ‘0’; } return $disqus_active; } You could also try something like this (not tested) add_filter( ‘the_content’, ‘wpse_load_disqus’); function … Read more

Hide notifications regarding new comments

Based off of the code from another question that you referenced, I’ve added onto it by changing the total number of comment using jQuery: add_filter( ‘the_comments’, ‘wpse_236055_filter_comments’ ); add_action( ‘admin_head’, ‘wpse_236055_comment_notification’ ); function wpse_236055_filter_comments( $comments ){ // Display comments related to the author global $pagenow, $user_ID, $comment_count; wp_get_current_user(); if ( $pagenow == ‘edit-comments.php’ && current_user_can( … Read more

Reject Comments Based on Author Email

Here’s a suggestion for a filter: /** * Filters a comment’s approval status before it is set. * * @since 2.1.0 * @since 4.9.0 Returning a WP_Error value from the filter will shortcircuit comment insertion and * allow skipping further processing. * * @param bool|string|WP_Error $approved The approval status. Accepts 1, 0, ‘spam’ or WP_Error. … Read more

How to allow more HTML tags in comment for a certain comment_type

This is untested but should work since it gives you the data you need to work from and runs prior to the pre_comment_content filter where the comment is sanitized. add_filter( ‘preprocess_comment’, ‘wpse_340526_preprocess_comment’ ); function wpse_340526_preprocess_comment( $commentdata ) { if( ‘wpse_response’ === $commentdata[‘comment_type’] ){ global $allowedtags; $allowedtags[‘pre’] = array(‘class’=>array()); $allowedtags[‘h2’] = array(); $allowedtags[‘h3’] = array(); $allowedtags[‘h4’] … Read more

Callback function argument which is required for wp_list_comments ()

wp_list_comments() uses Walker_Comment class to render the output. See Walker_Comment->start_el() method for callback argument: https://developer.wordpress.org/reference/classes/walker_comment/start_el/ And Walker_Comment->end_el() method for end-callback argument: https://developer.wordpress.org/reference/classes/walker_comment/end_el/

How can I fix wp_insert_comment failure when ‘comment_content” includes slanted apostrophe in Excel csv source data

If processed as saved, comments with slanted apostrophes/curled single quotes – ’ – are simply not inserted – they do not appear either in backend comments.php or in the post output. That’s because the wpdb class checks if the comment content contains any invalid (UTF-8) text, and if yes, then wpdb rejects the content and … Read more

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