yes, but you’ll need to tell AO about those, e.g. with a code snippet like this one;
add_filter( 'autoptimize_filter_css_replacetag', 'ao_css_replacetag', 10, 1 );
function my_ao_override_css_replacetag( $replacetag ) {
return array( '<!-- WP-Minify CSS -->', 'replace' );
}
add_filter( 'autoptimize_filter_js_replacetag', 'ao_js_replacetag', 10, 1 );
function my_ao_override_js_replacetag( $replacetag ) {
return array( '<!-- WP-Minify JS -->', 'replace' );
}
You will obviously have to make sure <!-- WP-Minify JS -->
and <!-- WP-Minify CSS -->
are present in your theme’s template files.
hope this helps,
frank
Hi frank … thx for you replay but your solution is not working … 🙁
Can you help me again? PLZ 🙂
sure, can you explain exactly what you did vollcom ?
Hi …
56867#0: *4668519 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($function) must be a valid callback, function "ao_js_replacetag" not found or invalid function name in
ah, a typo in my code snippet, stupid me .. try this;
add_filter( 'autoptimize_filter_css_replacetag', 'ao_css_replacetag', 10, 1 );
function ao_css_replacetag( $replacetag ) {
return array( '<!-- WP-Minify CSS -->', 'replace' );
}
add_filter( 'autoptimize_filter_js_replacetag', 'ao_js_replacetag', 10, 1 );
function ao_js_replacetag( $replacetag ) {
return array( '<!-- WP-Minify JS -->', 'replace' );
}
yes thx 🙂 I found also the little mistake but is also not working, because this
<!-- WP-Minify CSS -->
is an HTML comment.
I added this in theme’s template file:
<meta name=”minify” content=”css”>
<meta name=”minify” content=”js”>
and this in the function.php:
add_filter( 'autoptimize_filter_css_replacetag', 'my_ao_override_css_replacetag', 10, 1 );
function my_ao_override_css_replacetag( $replacetag ) {
return array( '<meta name="minify" content="css">', 'replace' );
}
add_filter( 'autoptimize_filter_js_replacetag', 'my_ao_override_js_replacetag', 10, 1 );
function my_ao_override_js_replacetag( $replacetag ) {
return array( '<meta name="minify" content="js">', 'replace' );
}
THX 🙂
now ist working
-
This reply was modified 3 years, 2 months ago by vollcom.
-
This reply was modified 3 years, 2 months ago by vollcom.
It _should_ work on HTML comments (as AO does the replacing before removing comments), but whatever the problem was happy it now works for you vollcom 🙂
feel free to leave a review of the plugin and support here! 🙂
have a nice day!
frank