Last active
May 15, 2017 00:29
-
-
Save rajuahmed/830be416b4ad440f9e40 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