New plugin

We have published a new plugin for HTML Optimization. It is advised to use the new plugin for access to the latest technologies and long term support.

Install new plugin

Minify HTML

Compress HTML using an enhanced version of HTML.php. This option will reduce the size of HTML but may require a full page cache to maintain an optimal server speed.

Strip HTML comments

Remove HTML comments from HTML, e.g. <!-- comment -->.

 
 Preserve List

Enter (parts of) HTML comments to exclude from removal. One string per line.

Search & Replace 

This option enables to replace strings in the HTML. Enter an array of JSON objects.

Example: {"search":"string to match","replace":"newstring"} (">show regular expression)

You can also add a search and replace configuration using the WordPress filter hook abtf_html_replace.

function your_html_search_and_replace( &$search, &$replace, &$search_regex, &$replace_regex ) {

	# regular string replace
	$search[] = 'string';
	$replace[] = '';

	# regex replace
	$search_regex[] = '|regex (string)|i';
	$replace_regex[] = '$1';

	return $search; // required
}

add_filter( 'abtf_html_replace', 'your_html_search_and_replace', 10, 4 );