-
-
Save bewho/8d44236d679a07dce6544ed0b97e496f to your computer and use it in GitHub Desktop.
Compress HTML file in wordpress theme to increase loading speed of wordpress site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Minify HTML codes when page is output. | |
add_action('wp_loaded','my_minify_html'); | |
function my_minify_html(){ | |
/** | |
* use html_compress($html) function to minify html codes. | |
*/ | |
ob_start('html_compress'); | |
} | |
function html_compress($html){ | |
/** | |
* some minify codes here ... | |
*/ | |
return $html; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment