Remove Yoast SEO Comments - Version 3.0.4

Version Description

  • Fixed issue with Yoast SEO head function not outputting.
Download this release

Release Info

Developer lowest
Plugin Icon wp plugin Remove Yoast SEO Comments
Version 3.0.4
Comparing to
See all releases

Code changes from version 3.1 to 3.0.4

Files changed (2) hide show
  1. readme.txt +1 -5
  2. remove-yoast-seo-comments.php +16 -26
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: yoast seo, yoast, seo, remove comments, remove html, remove ads, remove debug code, lightweight
5
  Requires at least: 1.2.0
6
  Stable tag: 1.2.0
7
- Tested up to: 4.9.1
8
 
9
  Removes the Yoast SEO advertisement HTML comments from your front-end source code.
10
 
@@ -46,10 +46,6 @@ No, this plugin will not modify any of your Yoast SEO plugin files.
46
 
47
  == Changelog ==
48
 
49
- = 3.1 =
50
- * All future Yoast SEO versions will be supported, even when Yoast SEO removes the functions we rely on.
51
- * Minor bug fixes.
52
-
53
  = 3.0.4 =
54
  * Fixed issue with Yoast SEO head function not outputting.
55
 
4
  Tags: yoast seo, yoast, seo, remove comments, remove html, remove ads, remove debug code, lightweight
5
  Requires at least: 1.2.0
6
  Stable tag: 1.2.0
7
+ Tested up to: 4.9
8
 
9
  Removes the Yoast SEO advertisement HTML comments from your front-end source code.
10
 
46
 
47
  == Changelog ==
48
 
 
 
 
 
49
  = 3.0.4 =
50
  * Fixed issue with Yoast SEO head function not outputting.
51
 
remove-yoast-seo-comments.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Remove Yoast SEO Comments
4
  * Plugin URI: https://wordpress.org/plugins/remove-yoast-seo-comments/
5
  * Description: Removes the Yoast SEO advertisement HTML comments from your front-end source code.
6
- * Version: 3.1
7
  * Author: Mitch
8
  * Author URI: https://profiles.wordpress.org/lowest
9
  * License: GPL-2.0+
@@ -30,10 +30,9 @@
30
  if ( ! defined( 'ABSPATH' ) ) { exit; }
31
 
32
  class RYSC {
33
- private $version = '3.1';
34
  private $debug_marker_removed = false;
35
  private $head_marker_removed = false;
36
- private $backup_plan_active = false;
37
 
38
  public function __construct() {
39
  add_action( 'init', array( $this, 'bundle' ), 1);
@@ -42,33 +41,19 @@ class RYSC {
42
  public function bundle() {
43
  if(defined( 'WPSEO_VERSION' )) {
44
  $debug_marker = ( version_compare( WPSEO_VERSION, '4.4', '>=' ) ) ? 'debug_mark' : 'debug_marker';
45
-
46
- // main function to unhook the debug msg
47
  if(class_exists( 'WPSEO_Frontend' ) && method_exists( 'WPSEO_Frontend', $debug_marker )) {
48
  remove_action( 'wpseo_head', array( WPSEO_Frontend::get_instance(), $debug_marker ) , 2);
49
-
50
  $this->debug_marker_removed = true;
51
-
52
- // also removes the end debug msg as of 5.9
53
- if(version_compare( WPSEO_VERSION, '5.9', '>=' )) $this->head_marker_removed = true;
54
  }
55
 
56
- // compatible solution for everything below 5.8
57
- if(class_exists( 'WPSEO_Frontend' ) && method_exists( 'WPSEO_Frontend', 'head' ) && version_compare( WPSEO_VERSION, '5.8', '<' )) {
58
  remove_action( 'wp_head', array( WPSEO_Frontend::get_instance(), 'head' ) , 1);
59
  add_action( 'wp_head', array($this, 'rewrite'), 1);
60
  $this->head_marker_removed = true;
61
  }
62
 
63
- // temp solution for all installations on 5.8
64
- if(version_compare( WPSEO_VERSION, '5.8', '==' )) {
65
- add_action('get_header', array( $this, 'buffer_header' ));
66
- add_action('wp_head', array( $this, 'buffer_head' ), 999);
67
- $this->head_marker_removed = true;
68
- }
69
-
70
- // backup solution
71
- if($this->operating_status() == 2) {
72
  add_action('get_header', array( $this, 'buffer_header' ));
73
  add_action('wp_head', array( $this, 'buffer_head' ), 999);
74
  }
@@ -97,19 +82,25 @@ class RYSC {
97
  if($this->operating_status() == 1) {
98
  $status = '<span style="color:#04B404;font-weight:bold">Fully supported</span>';
99
  $content = '<p>Version ' . WPSEO_VERSION . ' of Yoast SEO is fully supported by RYSC ' . $this->version . '. The HTML comments have been removed from your front-end source code.</p>';
 
100
  } elseif($this->operating_status() == 2) {
101
- $status = '<span style="color:#FF8000;font-weight:bold">Partially supported</span>';
102
- $content = '<p>Version ' . WPSEO_VERSION . ' of Yoast SEO is not properly supported by RYSC ' . $this->version . '. Some functions are not working. A backup solution has been enabled to keep the HTML comments removed.</p>';
 
103
  } elseif($this->operating_status() == 3) {
104
  $status = '<span style="color:#DF0101;font-weight:bold">Not supported</span>';
105
- $content = '<p>Version ' . WPSEO_VERSION . ' of Yoast SEO is not supported by RYSC ' . $this->version . '. A backup solution has been enabled to keep the HTML comments removed.</p>';
 
106
  }
107
 
108
  echo '<div class="activity-block"><h3><span class="dashicons dashicons-admin-plugins"></span> Yoast SEO ' . WPSEO_VERSION . ' Compatibility Status: ' . $status . '</h3></div>';
109
  echo $content;
 
 
 
110
  }
111
 
112
- // compatible solution for everything below 5.8
113
  public function rewrite() {
114
  $rewrite = new ReflectionMethod( 'WPSEO_Frontend', 'head' );
115
 
@@ -125,7 +116,7 @@ class RYSC {
125
  eval($body);
126
  }
127
 
128
- // temp solution for all installations on 5.8, and also the backup solution in the future
129
  public function buffer_header() {
130
  ob_start(function ($o) {
131
  return preg_replace('/\n?<.*?yoast.*?>/mi','',$o);
@@ -136,7 +127,6 @@ class RYSC {
136
  ob_end_flush();
137
  }
138
 
139
- // add plugin links to plugin page
140
  public function plugin_links( $link ) {
141
  $plugin_links = array_merge( $link, array('<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VYPRGME8QELC" target="_blank" rel="noopener noreferrer">' . __('Donate') . '</a>') );
142
 
3
  * Plugin Name: Remove Yoast SEO Comments
4
  * Plugin URI: https://wordpress.org/plugins/remove-yoast-seo-comments/
5
  * Description: Removes the Yoast SEO advertisement HTML comments from your front-end source code.
6
+ * Version: 3.0.4
7
  * Author: Mitch
8
  * Author URI: https://profiles.wordpress.org/lowest
9
  * License: GPL-2.0+
30
  if ( ! defined( 'ABSPATH' ) ) { exit; }
31
 
32
  class RYSC {
33
+ private $version = '3.0.4';
34
  private $debug_marker_removed = false;
35
  private $head_marker_removed = false;
 
36
 
37
  public function __construct() {
38
  add_action( 'init', array( $this, 'bundle' ), 1);
41
  public function bundle() {
42
  if(defined( 'WPSEO_VERSION' )) {
43
  $debug_marker = ( version_compare( WPSEO_VERSION, '4.4', '>=' ) ) ? 'debug_mark' : 'debug_marker';
44
+
 
45
  if(class_exists( 'WPSEO_Frontend' ) && method_exists( 'WPSEO_Frontend', $debug_marker )) {
46
  remove_action( 'wpseo_head', array( WPSEO_Frontend::get_instance(), $debug_marker ) , 2);
 
47
  $this->debug_marker_removed = true;
 
 
 
48
  }
49
 
50
+ if(class_exists( 'WPSEO_Frontend' ) && method_exists( 'WPSEO_Frontend', 'head' ) && WPSEO_VERSION < '5.8') {
 
51
  remove_action( 'wp_head', array( WPSEO_Frontend::get_instance(), 'head' ) , 1);
52
  add_action( 'wp_head', array($this, 'rewrite'), 1);
53
  $this->head_marker_removed = true;
54
  }
55
 
56
+ if(WPSEO_VERSION >= '5.8') {
 
 
 
 
 
 
 
 
57
  add_action('get_header', array( $this, 'buffer_header' ));
58
  add_action('wp_head', array( $this, 'buffer_head' ), 999);
59
  }
82
  if($this->operating_status() == 1) {
83
  $status = '<span style="color:#04B404;font-weight:bold">Fully supported</span>';
84
  $content = '<p>Version ' . WPSEO_VERSION . ' of Yoast SEO is fully supported by RYSC ' . $this->version . '. The HTML comments have been removed from your front-end source code.</p>';
85
+ $show_supported = false;
86
  } elseif($this->operating_status() == 2) {
87
+ $status = '<span style="color:#FF8000;font-weight:bold">Not properly supported</span>';
88
+ $content = '<p>Version ' . WPSEO_VERSION . ' of Yoast SEO is not properly supported by RYSC ' . $this->version . '. Some functions are not working. Please downgrade or wait for a plugin update.</p>';
89
+ $show_supported = true;
90
  } elseif($this->operating_status() == 3) {
91
  $status = '<span style="color:#DF0101;font-weight:bold">Not supported</span>';
92
+ $content = '<p>Version ' . WPSEO_VERSION . ' of Yoast SEO is not supported by RYSC ' . $this->version . '. Please downgrade or wait for a plugin update.</p>';
93
+ $show_supported = true;
94
  }
95
 
96
  echo '<div class="activity-block"><h3><span class="dashicons dashicons-admin-plugins"></span> Yoast SEO ' . WPSEO_VERSION . ' Compatibility Status: ' . $status . '</h3></div>';
97
  echo $content;
98
+ if($show_supported) {
99
+ echo '<p style="color:#808080"><span class="dashicons dashicons-lightbulb"></span> Want to downgrade? <a href="https://downloads.wordpress.org/plugin/wordpress-seo.4.9.zip" title="Download Yoast SEO 5.7.1">Yoast SEO 5.7.1</a> and earlier are tested and supported by RYSC.</p>';
100
+ }
101
  }
102
 
103
+ /* solution for < 5.8 */
104
  public function rewrite() {
105
  $rewrite = new ReflectionMethod( 'WPSEO_Frontend', 'head' );
106
 
116
  eval($body);
117
  }
118
 
119
+ /* solution for >= 5.8 */
120
  public function buffer_header() {
121
  ob_start(function ($o) {
122
  return preg_replace('/\n?<.*?yoast.*?>/mi','',$o);
127
  ob_end_flush();
128
  }
129
 
 
130
  public function plugin_links( $link ) {
131
  $plugin_links = array_merge( $link, array('<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VYPRGME8QELC" target="_blank" rel="noopener noreferrer">' . __('Donate') . '</a>') );
132