Plugin Directory

Changeset 3743287


Ignore:
Timestamp:
10/13/2026 08:42:06 AM (2 weeks ago)
Author:
senlin
Message:

commit v4.4.3 - see changelog for details

Location:
classic-editor-addon
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • classic-editor-addon/trunk/classic-editor-addon.php

    r3649292 r3743287  
    55
    66 * Author:                      <a href="https://so-wp.com">Pieter Bos</a>, <a href="https://gschoppe.com">Greg Schoppe</a>
    7  * Version:                     4.4.2
     7 * Version:                     4.4.3
    88
    99 * Requires at least:           5.5
    … …  
    163163    }
    164164}
     165
     166// Strip script handles from block types so WP_Block::render() cannot enqueue them at render time.
     167add_filter( 'block_type_metadata_settings', 'cea_strip_block_type_scripts', 10, 2 );
     168function cea_strip_block_type_scripts( $settings, $metadata ) {
     169    if ( ! is_admin() ) {
     170        $settings['script_handles']         = array();
     171        $settings['view_script_handles']    = array();
     172        $settings['view_script_module_ids'] = array();
     173        $settings['style_handles']          = array();
     174        $settings['view_style_handles']     = array();
     175    }
     176    return $settings;
     177}
     178
     179// Strip block assets from all registered block types on the front end.
     180add_action( 'wp_loaded', 'cea_strip_registered_block_scripts', 100 );
     181function cea_strip_registered_block_scripts() {
     182    if ( is_admin() ) {
     183        return;
     184    }
     185
     186    $registry = WP_Block_Type_Registry::get_instance();
     187    foreach ( $registry->get_all_registered() as $block_type ) {
     188        $block_type->script_handles         = array();
     189        $block_type->view_script_handles    = array();
     190        $block_type->view_script_module_ids = array();
     191        $block_type->style_handles          = array();
     192        $block_type->view_style_handles     = array();
     193    }
     194}
     195
     196// Dequeue and deregister common core block scripts if enqueued directly.
     197add_action( 'wp_enqueue_scripts', 'cea_remove_block_scripts', 100 );
     198function cea_remove_block_scripts() {
     199    wp_dequeue_script( 'wp-block-library' );
     200    wp_deregister_script( 'wp-block-library' );
     201
     202    // If script module API is available, dequeue any queued modules
     203    if ( function_exists( 'wp_script_modules' ) && method_exists( wp_script_modules(), 'get_queue' ) ) {
     204        $queue = wp_script_modules()->get_queue();
     205        if ( is_array( $queue ) && function_exists( 'wp_dequeue_script_module' ) ) {
     206            foreach ( $queue as $module_id ) {
     207                wp_dequeue_script_module( $module_id );
     208            }
     209        }
     210    }
     211}
     212
     213// Safety net for global styles, which can also be enqueued late.
     214remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
     215add_action( 'wp_footer', 'cea_dequeue_late_global_styles', 2 );
     216function cea_dequeue_late_global_styles() {
     217    wp_dequeue_style( 'global-styles' );
     218    wp_deregister_style( 'global-styles' );
     219}
  • classic-editor-addon/trunk/readme.txt

    r3649292 r3743287  
    55Requires PHP: 5.6
    66Tested up to: 7.1
    7 Stable tag: 4.4.2
     7Stable tag: 4.4.3
    88License: GPL-3.0+
    99License URI: http://www.gnu.org/licenses/gpl-3.0.txt
    … …  
    1818
    1919<strong>What's New:</strong>
    20 Removes WP Patterns
     20Several fixes that remove scripts/styles from frontend
    2121
    2222This plugin simply disables the WP Block Editor, removes any and all styling from both front- and backend and disables the block editor for widgets too.
    … …  
    5656
    5757== Changelog ==
     58
     59= 4.4.3 =
     60
     61* date: October 13, 2026
     62* Fix: block editor scripts and script modules are now removed on the front end
     63* Fix: block styles enqueued at render time (wp-block-*-inline-css) are now removed on the front end
     64* Fix: late loaded global-styles-inline-css is now removed on the front end
    5865
    5966= 4.4.2 =
Note: See TracChangeset for help on using the changeset viewer.