Forum Replies Created

Viewing 1 replies (of 1 total)
  • For me this was working the correct way in my theme to completely disable anything from the global-styles-inline-css. This workaround works for WP 6.9

    /**
    * Remove WordPress block styles completely.
    */
    add_action('wp_enqueue_scripts', function() {
    // Remove all WordPress block styles
    wp_dequeue_style('wp-block-library');
    wp_dequeue_style('wp-block-library-theme');
    wp_dequeue_style('wc-blocks-style'); // WooCommerce blocks
    wp_dequeue_style('classic-theme-styles');
    wp_dequeue_style('global-styles');
    }, 100);

    /**
    * Remove block styles from admin/editor as well.
    */
    add_action('admin_enqueue_scripts', function() {
    wp_dequeue_style('wp-block-library');
    wp_dequeue_style('wp-block-library-theme');
    });

    /**
    * Disable WordPress global styles (theme.json output).
    */
    add_filter('wp_theme_json_get_style_nodes', '__return_empty_array');

    /**
    * Remove global styles inline CSS completely.
    */
    remove_action('wp_enqueue_scripts', 'wp_enqueue_global_styles');
    remove_action('wp_footer', 'wp_enqueue_global_styles', 1);
Viewing 1 replies (of 1 total)