Easy Way to WordPress Disable Comments in Blogs! | Posts & Pages
Learn how to disable comments quickly on WordPress with a plugin in about a minute!
Code to copy paste:
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_safe_redirect(admin_url());
exit;
}
// Remove comments metabox from dashboard
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
// Disable support for comments and trackbacks in post types
foreach (get_post_types() as $post_type) {
if (post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
remove_post_type_support($post_type, 'trackbacks');
}
}
});
// Close comments on the front-end
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
// Hide existing comments
add_filter('comments_array', '__return_empty_array', 10, 2);
// Remove comments page in menu
add_action('admin_menu', function () {
remove_menu_page('edit-comments.php');
});
// Remove comments links from admin bar
add_action('init', function () {
if (is_admin_bar_showing()) {
remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
}
});
Видео Easy Way to WordPress Disable Comments in Blogs! | Posts & Pages канала Super Finesse
Code to copy paste:
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_safe_redirect(admin_url());
exit;
}
// Remove comments metabox from dashboard
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
// Disable support for comments and trackbacks in post types
foreach (get_post_types() as $post_type) {
if (post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
remove_post_type_support($post_type, 'trackbacks');
}
}
});
// Close comments on the front-end
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
// Hide existing comments
add_filter('comments_array', '__return_empty_array', 10, 2);
// Remove comments page in menu
add_action('admin_menu', function () {
remove_menu_page('edit-comments.php');
});
// Remove comments links from admin bar
add_action('init', function () {
if (is_admin_bar_showing()) {
remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
}
});
Видео Easy Way to WordPress Disable Comments in Blogs! | Posts & Pages канала Super Finesse
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
How to Add Instagram Feed to Your WordPress Website [2024] | Simple Plugin in 5 MinutesInstall WooCommerce in 5 Minutes | Easy WooCommerce TutorialHow to Buy a Domain Name on Namecheap & Set Up DNS to Any Host!How to Install WordPress on Google Cloud (Free Tier) - Tutorial | Free SSL, PHPMyAdmin, Domain.Adobe XD - Login Screen | Design Tutorial | Mobile App | PrototypeHow to Add Live Chat to WordPress FREE | FULL TUTORIAL [2024]How to Hide/Delete Photoshop Recent Files | Clear Recent - 2024How to Install CloudFlare on WordPress FREE | Protect Your WordPress SiteHow to Create NEON Text Effect in Illustrator CC | Easy Way!How to Install Rankmath in 5 Minutes | Quick & Easy TutorialInstagram Poster Design Illustrator CC | Simple Social Media Banner Design (2020)How to Reset WordPress Admin Password Using CPanel - (PhpMyAdmin Easy Method) [2024]Tunnel Lights in After Effects3D Transform Model MayaHow To Add Your Website To Bing Webmaster Tools [2024]How to Install Google Analytics for WordPress 2020 | Easy to setup for BeginnersHow To Duplicate A Page In WordPress 2024 | Easy WayHow to Install Yoast SEO Plugin in WordPress | Setup Yoast SEO 2020How to Switch Back to Classic WordPress Editor - [How To]How to Create Simple Business Card in Illustrator CC (2020)Run In Maya Animation (Mental Ray) Batch Rendered