• Resolved Zougou

    (@zougou)


    Hi,

    So far, to remove HTML Comments of AIO SEO plugin, I used this code below :

    if (defined('AIOSEOP_VERSION')) {
    	add_action('get_header', function() {
    		ob_start(
    			function($o) {
    				return preg_replace('/\n?<.*?One SEO Pack.*?>/mi','',$o);
    			}
    		);
    	});
    	add_action('wp_head', function() {
    		ob_end_flush();
    	}, 999);
    }

    But it doesn’t seem to work anymore with version 4 of AIO SEO PACK.
    Got an idea how to resolve this ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author arnaudbroes

    (@arnaudbroes)

    @zougou try changing '/\n?<.*?One SEO Pack.*?>/mi' to '/\n?<.*?One SEO.*?>/mi'.

    Thread Starter Zougou

    (@zougou)

    Thanks for your answer @arnaudbroes
    Unfortunately, this doesn’t work either

    Thread Starter Zougou

    (@zougou)

    Just found out that if I remove the conditionnal if (defined('AIOSEOP_VERSION')) {}
    the code works…

    Plugin Author arnaudbroes

    (@arnaudbroes)

    Oh yeah, sorry I missed that part. ??

    Thread Starter Zougou

    (@zougou)

    The constant AIOSEP_VERSION isn’t anymore defined in all_in_one_seo_pack.php file, that explains why the conditonnal if() sould be removed.

    For people searching how to remove AIO SEO HTML comments, here’s the hook :

    add_action('get_header', function() {
    	ob_start(
    		function($o) {
    			return preg_replace('/\n?<.*?One SEO.*?>/mi','',$o);
    		}
    	);
    });
    add_action('wp_head', function() {
    	ob_end_flush();
    }, 999);

    Thanks again @arnaudbroes for your help ??

    • This reply was modified 3 years, 8 months ago by Zougou.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove [All in One SEO Pack] HTML Comments’ is closed to new replies.