Skip to content

Instantly share code, notes, and snippets.

@ahmedch1
Created September 3, 2022 11:38
Show Gist options
  • Select an option

  • Save ahmedch1/ccdad5f700637d2fbc402f40c8d1204d to your computer and use it in GitHub Desktop.

Select an option

Save ahmedch1/ccdad5f700637d2fbc402f40c8d1204d to your computer and use it in GitHub Desktop.
if ( !is_user_logged_in() ) {
function sanitize_output($buffer) {
$search = array(
'/\>[^\S ]+/s', // strip whitespaces after tags, except space
'/[^\S ]+\</s', // strip whitespaces before tags, except space
'/(\s)+/s' // shorten multiple whitespace sequences
);
$replace = array(
'>',
'<',
'\\1'
);
$buffer = preg_replace($search, $replace, $buffer);
return $buffer;
}
ob_start("sanitize_output");
}
Source : https://www.quora.com/How-can-I-manually-speed-up-my-wordpress-site-without-plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment