• Resolved danielmoorehbd

    (@danielmoorehbd)


    Hi,
    I have spent a lot of time trying to minify CSS & JS on the back of WordPress with no joy.
    Also, there are many plugin/theme styles and scripts there that I can’t get rid of, this code doesn’t seem to work:

    function remove_cssjs_ver( $src ) {
    if( strpos( $src, '?ver=' ) )
     $src = remove_query_arg( 'ver', $src );
    return $src;
    }
    add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
    add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
    
    remove_action( 'wp_head', 'rsd_link' ) ;
    
    remove_action('wp_head', 'print_emoji_detection_script', 7);
    remove_action('wp_print_styles', 'print_emoji_styles');
    remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    remove_action( 'admin_print_styles', 'print_emoji_styles' );
    
    remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
    
    function disable_embed(){
    wp_dequeue_script( 'wp-embed' );
    }
    add_action( 'wp_footer', 'disable_embed' );
    
    add_filter('xmlrpc_enabled', '__return_false');
    
    remove_action( 'wp_head', 'wp_generator' ) ;
    
    remove_action( 'wp_head', 'wlwmanifest_link' ) ;
    
    function deregister_qjuery() { 
     if ( !is_admin() ) {
     wp_deregister_script('jquery');
     }
    } 
    add_action('wp_enqueue_scripts', 'deregister_qjuery');
    
    function disable_pingback( &$links ) {
     foreach ( $links as $l => $link )
     if ( 0 === strpos( $link, get_option( 'home' ) ) )
     unset($links[$l]);
    }
    add_action( 'pre_ping', 'disable_pingback' );
    
    add_action( 'init', 'stop_heartbeat', 1 );
    function stop_heartbeat() {
    wp_deregister_script('heartbeat');
    }
    
    add_filter( 'wpcf7_load_js', '__return_false' );
    add_filter( 'wpcf7_load_css', '__return_false' );
    
    function speedupadmin() { 
     if ( !is_admin() ) {
      wp_deregister_style('wp-admin');
      wp_deregister_style('fvp-backend');
      wp_deregister_style('cwginstock_admin_css'); //Back In Stock Notifier
      wp_deregister_style('wpmtst-admin-global-style'); //Strong Testimonials
      wp_deregister_style('trustpilotSideLogoStylesheet'); //Trustilot
      wp_deregister_style('wc-aelia-foundation-classes-admin'); //Aelia
     // wp_deregister_style('storefront-plugin-install') //Storefront Installer
      wp_deregister_style('arconix-faq-admin'); //Acronix FAQ
     }
    } 
    add_action('admin_enqueue_scripts', 'speedupadmin');
    
    if ( !is_admin() ) {
      remove_action('wp_enqueue_styles', 'wp_enqueue_styles');
    }
    
    remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); 
    remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); 
    remove_action( 'wp_print_styles', 'print_emoji_styles' ); 
    remove_action( 'admin_print_styles', 'print_emoji_styles' );
    
    add_action( 'admin_enqueue_scripts', 'admin_enqueue_scripts' );
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Minifying CSS & JS in WP-Admin Dashboard’ is closed to new replies.