As promised in the previous articles, we will discuss about the dequeue function for different WordPress plugins that will dequeue the unwanted stylesheet and script of different plugins that creates extra HTTP request that slow down your site. By using/adding this function to your theme’s function.php file will cut down the number of request and improve your site performance. But make sure that you append the plugin’s stylesheet and script with the theme’s stylesheet and script so that it won’t break the plugin functionality.
List Of Dequeue Function
Contact Form 7
styles.css
function jdc_remove_css(){ wp_dequeue_style('contact-form-7'); } add_action('wp_print_styles', 'jdc_remove_css', 99);
scripts.js
function remove_scripts(){ wp_dequeue_script('contact-form-7'); } add_action('wp_print_scripts', 'remove_scripts', 99);
Timeline Express
font-awesome.min.css
function remove_time_express_font_awesome(){ wp_dequeue_style( 'prefix-font-awesome' ); } add_filter( 'wp_footer', 'remove_time_express_font_awesome' );
timeline-express.min.css
function remove_time_express_css(){ wp_dequeue_style( 'timeline-express-base' ); } add_filter( 'wp_footer', 'remove_time_express_css' );
script.timeline-express.min.js
function remove_time_express_script(){ wp_dequeue_script( 'timeline-express-js-base' ); } add_filter( 'wp_footer', 'remove_time_express_script' );
Please bookmark this page as we will add more function in the future. If you have any plugin that you needed to dequeue please don’t hesitate to leave a comment along with the plugin’s name. We will be happy to help you.