Home » » Meringankan Generatepress

Meringankan Generatepress

1. Remove Classic-themes.css completely

Tambahkan kode berikut ke dalam file functions.php di dalam fungsi yang sesuai. Jika Anda tidak yakin di mana harus menambahkannya, Anda dapat menambahkannya di akhir file functions.php:

add_action( 'wp_enqueue_scripts', function() {
    wp_dequeue_style( 'classic-theme-styles' );
}, 20 );

 

2.Remove WordPress emoji code in your pages head without plugin

// Hapus emoji di halaman depan situs
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );

// Hapus emoji di halaman admin WordPress
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );

3. Disable global-styles-inline-css

Add the following code to functions.php of the theme you are using.

add_action( 'wp_enqueue_scripts', 'remove_global_styles' );
function remove_global_styles(){
    wp_dequeue_style( 'global-styles' );
}

=======================================================


=======================================================

function dequeue_rank_math_styles() {
    wp_dequeue_style('rank-math');
}
add_action('wp_enqueue_scripts', 'dequeue_rank_math_styles', 20);

function dequeue_crp_style() {
    wp_dequeue_style('crp-style-text-only');
    wp_deregister_style('crp-style-text-only');
}
add_action('wp_enqueue_scripts', 'dequeue_crp_style', 100);

function dequeue_fastest_cache_toolbar_style() {
    wp_dequeue_style('wp-fastest-cache-toolbar');
    wp_deregister_style('wp-fastest-cache-toolbar');
}
add_action('wp_enqueue_scripts', 'dequeue_fastest_cache_toolbar_style', 100);

=================================================================
function dequeue_admin_bar_style() {
    wp_dequeue_style('admin-bar');
}
add_action('wp_enqueue_scripts', 'dequeue_admin_bar_style', 100);

=================================================================

untuk cek handle:
function list_enqueued_styles() {
    global $wp_styles;
    foreach ($wp_styles->queue as $style) {
        echo $style . '<br>';
    }
}
add_action('wp_print_styles', 'list_enqueued_styles');

0 komentar:

Post a Comment