Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //A ajouter dans le fichier functions.php de votre thème
- //Add this to your theme functions.php file
- /* Supprime les commentaires de Yoast SEO dans le code source */
- /* Remove Yoast SEO comments in source code */
- if ( ! defined( 'ABSPATH' ) ) { exit; }
- function rysc_bundle() {
- if(defined( 'WPSEO_VERSION' ) && class_exists('WPSEO_Frontend')) {
- remove_action( 'wpseo_head', array( WPSEO_Frontend::get_instance(), 'debug_mark' ) , 2);
- remove_action( 'wp_head', array( WPSEO_Frontend::get_instance(), 'head' ) , 1);
- add_action( 'wp_head', 'rysc_rewrite' , 1);
- }
- }
- add_action( 'init', 'rysc_bundle' );
- function rysc_rewrite() {
- $rewrite = new ReflectionMethod( 'WPSEO_Frontend', 'head' );
- $filename = $rewrite->getFileName();
- $start_line = $rewrite->getStartLine();
- $end_line = $rewrite->getEndLine()-1;
- $length = $end_line - $start_line;
- $source = file($filename);
- $body = implode("", array_slice($source, $start_line, $length));
- $body = preg_replace( '/echo \'\<\!(.*?)\n/', '', $body);
- eval($body);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement