diff --git a/README.md b/README.md
index 88ac78c..5c94150 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
[![plugin version](https://img.shields.io/wordpress/plugin/v/so-clean-up-wp-seo)](https://wordpress.org/plugins/so-clean-up-wp-seo) [![WP compatibility](https://plugintests.com/plugins/wporg/so-clean-up-wp-seo/wp-badge.svg)](https://plugintests.com/plugins/wporg/so-clean-up-wp-seo/latest) [![PHP compatibility](https://plugintests.com/plugins/so-clean-up-wp-seo/php-badge.svg)](https://plugintests.com/plugins/so-clean-up-wp-seo/latest)
-###### Last updated on February 3, 2021
-###### Development version 3.14.5
+###### Last updated on February 4, 2021
+###### Development version 3.14.6
###### requires at least WordPress 4.9
###### tested up to WordPress 5.6
###### Author: [Pieter Bos](https://github.com/senlin)
@@ -17,7 +17,7 @@ Almost anyone who uses the Yoast SEO plugin will agree that it is a good SEO plu
**New in this version:**
-* fix React hide tabs conflict ([issue #94](https://github.com/senlin/so-clean-up-wp-seo/issues/94))
+* add condition to use new-ish `wpseo_debug_markers` filter to remove frontend comments in a backward compatible way; fixes [issue #95](https://github.com/senlin/so-clean-up-wp-seo/issues/95)
@@ -122,6 +122,11 @@ We welcome your contributions very much! PR's will be considered and of course b
## Changelog
+### 3.14.6
+
+* release date Fenruary 4, 2021
+* add condition to use new-ish `wpseo_debug_markers` filter to remove frontend comments in a backward compatible way; fixes [issue #95](https://github.com/senlin/so-clean-up-wp-seo/issues/95)
+
### 3.14.5
* release date February 3, 2021
diff --git a/includes/class-so-clean-up-wp-seo.php b/includes/class-so-clean-up-wp-seo.php
index fe82325..28763b2 100644
--- a/includes/class-so-clean-up-wp-seo.php
+++ b/includes/class-so-clean-up-wp-seo.php
@@ -99,7 +99,7 @@ class CUWS {
* @param string $file
* @param string $version Version number.
*/
- public function __construct( $file = '', $version = '3.14.5' ) {
+ public function __construct( $file = '', $version = '3.14.6' ) {
$this->_version = $version;
$this->_token = 'cuws';
@@ -212,22 +212,37 @@ public function so_cuws_remove_menu_item() {
/**
* Upon request by many the plugin now also removes the frontend HTML comments left by Yoast
* improvements of v3.11.1 via [Robert Went](https://gist.github.com/robwent/f36e97fdd648a40775379a86bd97b332)
+ * v3.14.6: added conditional for new filter tip from [Emanuel-23](https://github.com/senlin/so-clean-up-wp-seo/issues/95)
*
* @since v3.11.0
* @modified v3.11.1
+ * @modified v3.14.6
*/
public function so_cuws_remove_frontend_html_comments() {
-
+
if ( ! empty( $this->options['remove_html_comments'] ) ) {
-
+
if ( defined( 'WPSEO_VERSION' ) ) {
- add_action( 'get_header', function () { ob_start( function ( $o ) {
- return preg_replace( '/\n?<.*?Yoast SEO plugin.*?>/mi', '', $o ); } ); } );
- add_action('wp_head',function (){ ob_end_flush(); }, 999);
+
+ $wpseo_version = constant( 'WPSEO_VERSION' );
+
+ // the wpseo_debug_markers() filter was added in WP SEO version 14.1
+ if ( $wpseo_version < 14.1 ) {
+
+ add_action( 'get_header', function () { ob_start( function ( $o ) {
+ return preg_replace( '/\n?<.*?Yoast SEO plugin.*?>/mi', '', $o ); } ); } );
+ add_action( 'wp_head',function (){ ob_end_flush(); }, 999 );
+
+ } else {
+
+ add_filter( 'wpseo_debug_markers', '__return_false' );
+
+ }
+
}
-
+
}
- }
+ }
/**
* Remove warning notice when changing permalinks
@@ -513,7 +528,7 @@ function i18n() {
*
* @return CUWS $_instance
*/
- public static function instance( $file = '', $version = '3.14.5' ) {
+ public static function instance( $file = '', $version = '3.14.6' ) {
if ( null === self::$_instance ) {
self::$_instance = new self( $file, $version );
}
diff --git a/readme.txt b/readme.txt
index 601c1c9..a47ba96 100644
--- a/readme.txt
+++ b/readme.txt
@@ -5,7 +5,7 @@ Tags: hide, seo, bloat, remove, ads, cartoon, wordpress seo addon, admin columns
Requires at least: 4.9
Requires PHP: 5.6
Tested up to: 5.6
-Stable tag: 3.14.5
+Stable tag: 3.14.6
License: GPL-3.0+
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
@@ -17,7 +17,7 @@ Almost anyone who uses the Yoast SEO plugin will agree that it is a good SEO plu
**New in this version:**
-* fix React hide tabs conflict ([issue #94](https://github.com/senlin/so-clean-up-wp-seo/issues/94))
+* add condition to use new-ish `wpseo_debug_markers` filter to remove frontend comments in a backward compatible way; fixes [issue #95](https://github.com/senlin/so-clean-up-wp-seo/issues/95)
@@ -111,6 +111,11 @@ Please open an issue on [Github](https://github.com/senlin/so-clean-up-wp-seo/is
== Changelog ==
+= 3.14.6 =
+
+* release date February 4, 2021
+* add condition to use new-ish `wpseo_debug_markers` filter to remove frontend comments in a backward compatible way; fixes [issue #95](https://github.com/senlin/so-clean-up-wp-seo/issues/95)
+
= 3.14.5 =
* release date February 3, 2021
diff --git a/so-clean-up-wp-seo.php b/so-clean-up-wp-seo.php
index 358df8f..a07aee2 100644
--- a/so-clean-up-wp-seo.php
+++ b/so-clean-up-wp-seo.php
@@ -3,7 +3,7 @@
* Plugin Name: Hide SEO Bloat
* Plugin URI: https://so-wp.com/plugin/hide-seo-bloat
* Description: Hide most of the bloat that the Yoast SEO plugin adds to your WordPress Dashboard
- * Version: 3.14.5
+ * Version: 3.14.6
* Author: SO WP
* Author URI: https://so-wp.com
* License: GPL-3.0+
@@ -34,7 +34,7 @@
* @return object CUWS
*/
function CUWS () {
- $instance = CUWS::instance( __FILE__, '3.14.5' );
+ $instance = CUWS::instance( __FILE__, '3.14.6' );
if ( null === $instance->settings ) {
$instance->settings = CUWS_Settings::instance( $instance );