okay, i updated the code so i can add to a custom plugin for now.
but it doesn’t seem to work too on the backend, so not preventing conversion to classic block.
// Ensure that the function exists before attempting to remove it
if (function_exists('teckel_init_minify_html')) {
// Remove the original filter hook
remove_filter('template_redirect', 'teckel_init_minify_html');
}
// Define your modified function
function new_teckel_init_minify_html() {
if (is_admin() || (defined('REST_REQUEST') && REST_REQUEST) || (defined('DOING_AJAX') && DOING_AJAX)) {
return;
}
$minify_html_active = get_option('minify_html_active');
if ($minify_html_active != 'no') {
ob_start('teckel_minify_html_output');
}
}
// Add your modified function as a filter hook
add_filter('template_redirect', 'new_teckel_init_minify_html');
Though, the conversion to classic block does happen on every save draft or update. but it doesn’t matter when you refresh the page after updating. It all is back to normal.
@sujaljain007 I modified the code directly in plugin. Plugin doesn’t get many updates and I hope it get’s updated with fix I’ve provided or similar as plugin author was active here.
Hello
Same problem here…
Anybody found a working fix ?
Regards
@jirsbek ok thanks !
Where is this function ? in function.php ?
@byothe Well teckel_init_minify_html() is original function located directly in the plugin’s core file minify-html.php. As it’s definitely not ideal to modify the file directly it’s the only way I made the modification work. I hope author is watching this post and will update the plugin.
I have the same issue for weeks now and it is pain in th***. Any update guys on this fix? Very much appreciated
-
This reply was modified 1 month, 1 week ago by gringopost.
Where do you add this?
function teckel_init_minify_html() {
if (is_admin() || (defined(‘REST_REQUEST’) && REST_REQUEST) || (defined(‘DOING_AJAX’) && DOING_AJAX)) {
return;
}
$minify_html_active = get_option(‘minify_html_active’);
if ($minify_html_active != ‘no’) {
ob_start(‘teckel_minify_html_output’);
}
}
add_action(‘template_redirect’, ‘teckel_init_minify_html’);
@gringopost
It’s in the minify-html.php file… in the plugin directory on your site
wp-content > plugins > minify-html-markup > minify-html.php