Friday, October 6, 2023
HomeMobile MarketingWordPress: Why I Eliminated Feedback (And How I Eliminated Them)

WordPress: Why I Eliminated Feedback (And How I Eliminated Them)


I deleted all feedback on Martech Zone immediately and disabled all feedback in my youngster theme. Let’s talk about why it’s a sensible transfer to take away and disable feedback in your WordPress web site:

  1. Spam Prevention: Feedback on WordPress websites are infamous for attracting spam. These spam feedback can muddle your web site and hurt your on-line status. Managing and filtering by these spam feedback could be time-consuming and counterproductive. By disabling feedback, you’ll be able to get rid of this problem.
  2. Photographs Not Discovered: As I crawled the positioning for points, one which continued to crop up was commenters that had deserted using Gravatar, WordPress’ technique of displaying a commenter’s profile avatar or picture. As a substitute of Gravatar gracefully displaying a typical picture, it might as a substitute produce a file not discovered, slowing the positioning and producing errors. So as to right this, I’d should troubleshoot the commenter and delete them… too time-consuming.
  3. Sustaining Hyperlink High quality: Permitting feedback in your WordPress web site can result in the inclusion of exterior hyperlinks inside these feedback. A few of these hyperlinks could also be from low-quality or spammy web sites. Serps contemplate the standard of outbound hyperlinks when rating your web site. Disabling feedback helps you preserve management over the hyperlinks in your web site and prevents probably dangerous hyperlinks from affecting your rankings.
  4. Time Effectivity: Managing and moderating feedback can considerably drain your time and sources. Time spent managing feedback might be higher utilized for different essential duties associated to your gross sales and advertising efforts. Disabling feedback frees up worthwhile time to give attention to content material creation, web optimization optimization, and different gross sales and advertising actions.
  5. Shift to Social Media: Lately, the panorama of on-line discussions has shifted away from web site feedback and extra in direction of social media platforms. Customers usually tend to share, remark, and interact along with your content material on social media websites like Fb, Twitter, or LinkedIn. By directing the dialog to those platforms, you’ll be able to faucet into bigger, extra lively communities and improve your advertising efforts.

The best way to Delete Feedback

Utilizing MySQL and PHPMyAdmin, you’ll be able to delete all present feedback with the next SQL command:

TRUNCATE TABLE wp_commentmeta;
TRUNCATE TABLE wp_comments;

In case your WordPress tables have a distinct prefix than wp_, you’ll want to switch the instructions for that.

The best way to Take away Feedback

This code in your WordPress theme or youngster theme’s capabilities.php file is a set of capabilities and filters designed to disable and take away numerous facets of the remark system in your WordPress web site:

// Disable remark feeds
perform disable_comment_feeds(){
    // Add default posts and feedback RSS feed hyperlinks to move.
    add_theme_support( 'automatic-feed-links' );

    // disable feedback feed
    add_filter( 'feed_links_show_comments_feed', '__return_false' ); 
}
add_action( 'after_setup_theme', 'disable_comment_feeds' );

// Disable feedback on all submit varieties
perform disable_comments_post_types_support() {
	$post_types = get_post_types();
	foreach ($post_types as $post_type) {
		if(post_type_supports($post_type, 'feedback')) {
			remove_post_type_support($post_type, 'feedback');
			remove_post_type_support($post_type, 'trackbacks');
		}
	}
}
add_action('admin_init', 'disable_comments_post_types_support');

// Disable feedback
perform disable_comments_status() {
	return false;
}
add_filter('comments_open', 'disable_comments_status', 10, 2);
add_filter('pings_open', 'disable_comments_status', 10, 2);

// Disguise present feedback all over the place
perform disable_comments_hide_existing_comments($feedback) {
	$feedback = array();
	return $feedback;
}
add_filter('comments_array', 'disable_comments_hide_existing_comments', 10, 2);

// Disable feedback menu in admin
perform disable_comments_admin_menu() {
	remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'disable_comments_admin_menu');

// Redirect customers making an attempt to entry feedback web page
perform disable_comments_admin_menu_redirect() {
	international $pagenow;
	if ($pagenow === 'edit-comments.php') {
		wp_redirect(admin_url()); exit;
	}
}
add_action('admin_init', 'disable_comments_admin_menu_redirect');

Let’s break down every half:

  1. disable_comment_feeds: This perform disables remark feeds. It first provides help for automated feed hyperlinks in your theme. Then, it makes use of the feed_links_show_comments_feed filter to return false, successfully disabling the feedback feed.
  2. disable_comments_post_types_support: This perform iterates by all of the submit varieties in your WordPress set up. For every submit kind that helps feedback (post_type_supports($post_type, 'feedback')), it removes help for feedback and trackbacks. This successfully disables feedback for all submit varieties.
  3. disable_comments_status: These capabilities filter the standing of feedback and pings on the front-end to return false, successfully closing feedback and pings for all posts.
  4. disable_comments_hide_existing_comments: This perform hides present feedback by returning an empty array when the comments_array filter is utilized. This ensures that present feedback received’t be displayed in your web site.
  5. disable_comments_admin_menu: This perform removes the “Feedback” web page from the WordPress admin menu. Customers with the mandatory permissions will now not see the choice to handle feedback.
  6. disable_comments_admin_menu_redirect: If a person tries to entry the feedback web page immediately by navigating to ‘edit-comments.php,’ this perform redirects them to the WordPress admin dashboard utilizing wp_redirect(admin_url());.

This code utterly disables the remark system in your WordPress web site. It not solely disables feedback for all submit varieties but in addition hides present feedback, removes the feedback web page from the admin menu, and redirects customers away from the feedback web page. This may be useful in conditions the place you don’t need to use the remark performance and need to simplify your WordPress web site’s backend.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments