وردپرس
terrible if you need to optimize js/css – [Gutenberg] Review
If you are trying to optimize your website and find that you can no longer edit your blocks and only a blank page appears, you will need to remove the optimization or remove this plugin.
One solution I found to not remove this plugin and continue with the optimizations was to remove the non-critical js rendering through functions.php with the following function:
//remove render blocking from non-critical js
//- unless it is within the WordPress administration interface
//- and except cart_page
function defer_parsing_of_js ( $url ) {
if ( is_admin() ) return $url;
if ( is_cart () ) return $url;
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'jquery.js' ) ) return $url;
return "$url' defer ";
}
add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
مشاهده پاسخ های این مطلب
———————————————
این مطلب از سایت انجمن وردپرس گردآوری شده است و کلیه حقوق مطلق به انجمن وردپرس می باشد در صورت مغایرت و یا بروز مشکل اطلاع دهید تا حذف گردد
منبع: انجمن وردپرس