-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
senlin
Author
Owner
|
||
|
||
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 | ||
|
@senlin
this condition will not work correctly. even if this might look uncritical at first sight, when for example autocasting a string with php to a float and comparing it to the hard coded float value, this might result in unwanted behavior and might be hard to debug afterwards.
I'd strongly suggest to use PHPs version_compare instead.