- Install this plugin: https://wordpress.org/plugins/autoptimize/
- Enable in its options wp-admin/options-general.php?page=autoptimize 'Optimize HTML Code?'
- In file functions.php of your current wp theme apply next code123456789101112131415161718add_filter('autoptimize_html_after_minify', function($content) {$site_url = 'https://bulk-editor.com/';$content = str_replace("", ' ', $content);$content = str_replace('', ' ', $content);$content = str_replace(" ", ' ', $content);$content = str_replace(' ', ' ', $content);$content = str_replace($site_url . '/wp-includes/js', '/wp-includes/js', $content);$content = str_replace($site_url . '/wp-content/cache/autoptimize', '/wp-content/cache/autoptimize', $content);$content = str_replace($site_url . '/wp-content/themes/', '/wp-content/themes/', $content);$content = str_replace($site_url . '/wp-content/uploads/', '/wp-content/uploads/', $content);$content = str_replace($site_url . '/wp-content/plugins/', '/wp-content/plugins/', $content);return $content;}, 10, 1);
- Do not forget in $site_url change link to your site link without slash on its end
