• Resolved egornmore

    (@egornmore)


    Hello,
    Is there any way to add HTML comments <!– –> in the head tag? I’m trying to do so using ‘wp_head’ function but comments don’t appear

    • This topic was modified 2 years, 8 months ago by egornmore.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Milind More

    (@milindmore22)

    Hello @egornmore

    Thank you for support topic, HTML comments are stripped out to optimize the DOM

    Also please note that conditional HTML comments are not allowed on AMP

    Hope this helps!

    Plugin Author Weston Ruter

    (@westonruter)

    If you want to turn off HTML comment removal, you can use this PHP plugin code:

    add_filter( 'amp_optimizer_config', static function ( $config ) {
    	$config['transformers'] = array_diff(
    		$config['transformers'],
    		[
    			\AmpProject\Optimizer\Transformer\MinifyHtml::class,
    		]
    	);
    	return $config;
    } );
    Thread Starter egornmore

    (@egornmore)

    It works
    Thanks for your time!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘HTML Comments in Head’ is closed to new replies.