Support » Plugin: Autoptimize » Add hook into classes\autoptimizeHTML.php

  • Resolved RealMag777

    (@realmag777)


    Hello

    Add please hook into classes\autoptimizeHTML.php -> public function minify() -> before ‘return true’ https://clip2net.com/s/3TH8tbi

    This will allow do such tricks in functions.php as:

    add_filter('my-html-code-optimizer', function($content) {
    
        $site_url = 'https://bulk-editor.com/';
    
        $content = str_replace("type='text/javascript'", ' ', $content);
        $content = str_replace('type="text/javascript"', ' ', $content);
    
        $content = str_replace("type='text/css'", ' ', $content);
        $content = str_replace('type="text/css"', ' ', $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);

    Now it can be done by hardcode only.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add hook into classes\autoptimizeHTML.php’ is closed to new replies.