Make WordPress Core

Ticket #59090: 59090.diff

File 59090.diff, 1017 bytes (added by poena, 14 months ago)

Conditionally load the JavaScript file that unregisters the squared button block style

  • src/wp-content/themes/twentytwenty/functions.php

     
    430430                wp_add_inline_style( 'twentytwenty-block-editor-styles', $custom_css );
    431431        }
    432432
    433         // Enqueue the editor script.
    434         wp_enqueue_script( 'twentytwenty-block-editor-script', get_theme_file_uri( '/assets/js/editor-script-block.js' ), array( 'wp-blocks', 'wp-dom' ), wp_get_theme()->get( 'Version' ), true );
     433        // Enqueue the editor script and unregister the squared button block style.
     434        if ( version_compare( $GLOBALS['wp_version'], '5.3', '<' ) ) {
     435                wp_enqueue_script( 'twentytwenty-block-editor-script', get_theme_file_uri( '/assets/js/editor-script-block.js' ), array( 'wp-blocks', 'wp-dom' ), wp_get_theme()->get( 'Version' ), true );
     436        }
    435437}
    436438
    437439add_action( 'enqueue_block_editor_assets', 'twentytwenty_block_editor_styles', 1, 1 );