Saturday, October 7, 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 as we speak and disabled all feedback in my baby 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 possibly can remove 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 an alternative of Gravatar gracefully displaying an ordinary picture, it could as a substitute produce a file not discovered, slowing the positioning and producing errors. In an effort to appropriate this, I’d must 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 assets. Time spent managing feedback may very well be higher utilized for different essential duties associated to your gross sales and advertising and marketing efforts. Disabling feedback frees up priceless time to give attention to content material creation, web optimization optimization, and different gross sales and advertising and marketing actions.
  5. Shift to Social Media: In recent times, 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 have interaction along with your content material on social media websites like Fb, Twitter, or LinkedIn. By directing the dialog to those platforms, you possibly can faucet into bigger, extra energetic communities and improve your advertising and marketing efforts.

How you can Delete Feedback

Utilizing MySQL and PHPMyAdmin, you possibly can delete all present feedback with the next SQL command:

TRUNCATE TABLE wp_commentmeta;
TRUNCATE TABLE wp_comments;

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

How you can Take away Feedback

This code in your WordPress theme or baby theme’s capabilities.php file is a set of capabilities and filters designed to disable and take away varied features 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 go.
    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 put up 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);

// Conceal 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() {
	world $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 assist for computerized 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 put up varieties in your WordPress set up. For every put up sort that helps feedback (post_type_supports($post_type, 'feedback')), it removes assist for feedback and trackbacks. This successfully disables feedback for all put up 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 gained’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 required permissions will now not see the choice to handle feedback.
  6. disable_comments_admin_menu_redirect: If a consumer tries to entry the feedback web page straight 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 put up varieties but additionally 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 wish to use the remark performance and wish to simplify your WordPress web site’s backend.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments