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 right this moment and disabled all feedback in my youngster theme. Let’s talk about why it’s a wise 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 repute. Managing and filtering by these spam feedback may be time-consuming and counterproductive. By disabling feedback, you may remove this trouble.
  2. Photos Not Discovered: As I crawled the location 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 a regular picture, it will as a substitute produce a file not discovered, slowing the location and producing errors. In an effort to right this, I’d must troubleshoot the commenter and delete them… too time-consuming.
  3. Sustaining Hyperlink High quality: Permitting feedback in your WordPress website 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. Search engines like google contemplate the standard of outbound hyperlinks when rating your web site. Disabling feedback helps you preserve management over the hyperlinks in your website 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 could possibly be higher utilized for different essential duties associated to your gross sales and advertising and marketing efforts. Disabling feedback frees up precious time to deal with content material creation, search engine optimization optimization, and different gross sales and advertising and marketing actions.
  5. Shift to Social Media: Lately, the panorama of on-line discussions has shifted away from web site feedback and extra in the 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 may faucet into bigger, extra energetic communities and improve your advertising and marketing efforts.

How you can Delete Feedback

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

TRUNCATE TABLE wp_commentmeta;
TRUNCATE TABLE wp_comments;

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

How you can Take away Feedback

This code in your WordPress theme or youngster theme’s features.php file is a set of features and filters designed to disable and take away numerous elements 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);

// Cover present feedback in every single 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 attempting 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 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 submit varieties in your WordPress set up. For every submit sort that helps feedback (post_type_supports($post_type, 'feedback')), it removes assist for feedback and trackbacks. This successfully disables feedback for all submit varieties.
  3. disable_comments_status: These features 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 person 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 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 website’s backend.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments