Version Description
- Hide existing comments if there are any.
- Filter the comments link in the Meta widget if it is enabled.
Download this release
Release Info
| Developer | solarissmoke |
| Plugin | |
| Version | 1.5.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.5 to 1.5.1
- disable-comments.php +15 -2
- readme.txt +5 -1
disable-comments.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: Disable Comments
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/disable-comments/
|
| 5 |
Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type.
|
| 6 |
-
Version: 1.5
|
| 7 |
Author: Samir Shah
|
| 8 |
Author URI: http://rayofsolaris.net/
|
| 9 |
License: GPL2
|
|
@@ -52,7 +52,7 @@ class Disable_Comments {
|
|
| 52 |
}
|
| 53 |
|
| 54 |
private function check_compatibility() {
|
| 55 |
-
if ( version_compare( $GLOBALS['wp_version'], '3.
|
| 56 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
| 57 |
deactivate_plugins( __FILE__ );
|
| 58 |
if ( isset( $_GET['action'] ) && ( $_GET['action'] == 'activate' || $_GET['action'] == 'error_scrape' ) ) {
|
|
@@ -151,6 +151,7 @@ class Disable_Comments {
|
|
| 151 |
remove_post_type_support( $type, 'trackbacks' );
|
| 152 |
}
|
| 153 |
}
|
|
|
|
| 154 |
add_filter( 'comments_open', array( $this, 'filter_comment_status' ), 20, 2 );
|
| 155 |
add_filter( 'pings_open', array( $this, 'filter_comment_status' ), 20, 2 );
|
| 156 |
}
|
|
@@ -193,6 +194,7 @@ class Disable_Comments {
|
|
| 193 |
|
| 194 |
if( $this->options['remove_everywhere'] ) {
|
| 195 |
add_filter( 'feed_links_show_comments_feed', '__return_false' );
|
|
|
|
| 196 |
}
|
| 197 |
}
|
| 198 |
}
|
|
@@ -336,6 +338,17 @@ jQuery(document).ready(function($){
|
|
| 336 |
}
|
| 337 |
}
|
| 338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
public function filter_comment_status( $open, $post_id ) {
|
| 340 |
$post = get_post( $post_id );
|
| 341 |
return ( $this->options['remove_everywhere'] || $this->is_post_type_disabled( $post->post_type ) ) ? false : $open;
|
| 3 |
Plugin Name: Disable Comments
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/disable-comments/
|
| 5 |
Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type.
|
| 6 |
+
Version: 1.5.1
|
| 7 |
Author: Samir Shah
|
| 8 |
Author URI: http://rayofsolaris.net/
|
| 9 |
License: GPL2
|
| 52 |
}
|
| 53 |
|
| 54 |
private function check_compatibility() {
|
| 55 |
+
if ( version_compare( $GLOBALS['wp_version'], '3.7', '<' ) ) {
|
| 56 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
| 57 |
deactivate_plugins( __FILE__ );
|
| 58 |
if ( isset( $_GET['action'] ) && ( $_GET['action'] == 'activate' || $_GET['action'] == 'error_scrape' ) ) {
|
| 151 |
remove_post_type_support( $type, 'trackbacks' );
|
| 152 |
}
|
| 153 |
}
|
| 154 |
+
add_filter( 'comments_array', array( $this, 'filter_existing_comments' ), 20, 2 );
|
| 155 |
add_filter( 'comments_open', array( $this, 'filter_comment_status' ), 20, 2 );
|
| 156 |
add_filter( 'pings_open', array( $this, 'filter_comment_status' ), 20, 2 );
|
| 157 |
}
|
| 194 |
|
| 195 |
if( $this->options['remove_everywhere'] ) {
|
| 196 |
add_filter( 'feed_links_show_comments_feed', '__return_false' );
|
| 197 |
+
add_action( 'wp_footer', array( $this, 'hide_meta_widget_link' ) );
|
| 198 |
}
|
| 199 |
}
|
| 200 |
}
|
| 338 |
}
|
| 339 |
}
|
| 340 |
|
| 341 |
+
public function hide_meta_widget_link(){
|
| 342 |
+
if ( is_active_widget( false, false, 'meta', true ) && wp_script_is( 'jquery', 'enqueued' ) ) {
|
| 343 |
+
echo '<script> jQuery(function($){ $(".widget_meta a[href=\'' . esc_url( get_bloginfo( 'comments_rss2_url' ) ) . '\']").parent().remove(); }); </script>';
|
| 344 |
+
}
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
public function filter_existing_comments($comments, $post_id) {
|
| 348 |
+
$post = get_post( $post_id );
|
| 349 |
+
return ( $this->options['remove_everywhere'] || $this->is_post_type_disabled( $post->post_type ) ) ? array() : $comments;
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
public function filter_comment_status( $open, $post_id ) {
|
| 353 |
$post = get_post( $post_id );
|
| 354 |
return ( $this->options['remove_everywhere'] || $this->is_post_type_disabled( $post->post_type ) ) ? false : $open;
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: solarissmoke
|
|
| 3 |
Donate link: http://www.rayofsolaris.net/donate/
|
| 4 |
Tags: comments, disable, global
|
| 5 |
Requires at least: 4.0
|
| 6 |
-
Tested up to: 4.
|
| 7 |
Stable tag: trunk
|
| 8 |
|
| 9 |
Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. Multisite friendly.
|
|
@@ -68,6 +68,10 @@ These definitions can be made either in your main `wp-config.php` or in your the
|
|
| 68 |
|
| 69 |
== Changelog ==
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
= 1.5 =
|
| 72 |
* Remove the comments feed link from the head in WP 4.4 and higher.
|
| 73 |
|
| 3 |
Donate link: http://www.rayofsolaris.net/donate/
|
| 4 |
Tags: comments, disable, global
|
| 5 |
Requires at least: 4.0
|
| 6 |
+
Tested up to: 4.6
|
| 7 |
Stable tag: trunk
|
| 8 |
|
| 9 |
Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. Multisite friendly.
|
| 68 |
|
| 69 |
== Changelog ==
|
| 70 |
|
| 71 |
+
= 1.5.1 =
|
| 72 |
+
* Hide existing comments if there are any.
|
| 73 |
+
* Filter the comments link in the Meta widget if it is enabled.
|
| 74 |
+
|
| 75 |
= 1.5 =
|
| 76 |
* Remove the comments feed link from the head in WP 4.4 and higher.
|
| 77 |
|
