Plugin Directory

Changeset 3201949


Ignore:
Timestamp:
12/03/2024 09:01:52 PM (12 months ago)
Author:
azaozz
Message:

Classic Editor: Fix loading of script translations when post.js is replaced in WP 6.7.1.

Location:
classic-editor/trunk
Files:
2 edited

Legend:

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

    r3195295 r3201949  
    66 * Plugin URI:  https://wordpress.org/plugins/classic-editor/
    77 * Description: Enables the WordPress classic editor and the old-style Edit Post screen with TinyMCE, Meta Boxes, etc. Supports the older plugins that extend this screen.
    8  * Version:     1.6.6
     8 * Version:     1.6.7
    99 * Author:      WordPress Contributors
    1010 * Author URI:  https://github.com/WordPress/classic-editor/
     
    7070        add_action( 'admin_print_styles', array( __CLASS__, 'safari_18_temp_fix' ) );
    7171
    72         // Fix for the Categories postbox for WP 6.7.1.
     72        // Fix for the Categories postbox on the classic Edit Post screen for WP 6.7.1.
    7373        global $wp_version;
    7474
    7575        if ( '6.7.1' === $wp_version && is_admin() ) {
    76             add_action( 'wp_default_scripts', array( __CLASS__, 'replace_post_js' ), 11 );
     76            add_filter( 'script_loader_src', array( __CLASS__, 'replace_post_js_2' ), 11, 2 );
    7777        }
    7878
     
    10081008    }
    10091009
    1010     /**
    1011      * Temporary fix for the Categories postbox on the classic Edit Post screen.
    1012      * See: https://core.trac.wordpress.org/ticket/62504.
    1013      */
     1010    // Back-compat with 1.6.6.
    10141011    public static function replace_post_js( $scripts ) {
    1015         $script = $scripts->query( 'post', 'registered' );
    1016         $suffix = wp_scripts_get_suffix();
    1017 
    1018         if ( $script ) {
    1019             if ( '62504-20241121' === $script->ver ) {
    1020                 // The script src was replaced from another plugin.
    1021                 return;
    1022             }
    1023 
    1024             $script->src = plugins_url( 'scripts/', __FILE__ ) . "post{$suffix}.js";
    1025             $script->ver = '62504-20241121';
    1026         } else {
    1027             $scripts->add(
    1028                 'post',
    1029                 plugins_url( 'scripts/', __FILE__ ) . "post{$suffix}.js",
    1030                 array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y', 'wp-sanitize', 'clipboard' ),
    1031                 '62504-20241121',
    1032                 1
    1033             );
    1034             $scripts->set_translations( 'post' );
    1035         }
     1012        _deprecated_function( __METHOD__, '1.6.7' );
     1013    }
     1014
     1015    /**
     1016     * Fix for the Categories postbox on the classic Edit Post screen for WP 6.7.1.
     1017     * See: https://core.trac.wordpress.org/ticket/62504 and
     1018     * https://github.com/WordPress/classic-editor/issues/222.
     1019     */
     1020    public static function replace_post_js_2( $src, $handle ) {
     1021        if ( 'post' === $handle && is_string( $src ) && false === strpos( $src, 'ver=62504-20241121' ) ) {
     1022            $suffix = wp_scripts_get_suffix();
     1023            $src    = plugins_url( 'scripts/', __FILE__ ) . "post{$suffix}.js";
     1024            $src    = add_query_arg( 'ver', '62504-20241121', $src );
     1025        }
     1026
     1027        return $src;
    10361028    }
    10371029}
  • classic-editor/trunk/readme.txt

    r3195295 r3201949  
    11=== Classic Editor ===
    22Contributors: wordpressdotorg, azaozz, melchoyce, chanthaboune, alexislloyd, pento, youknowriad, desrosj, luciano-croce, ironprogrammer
    3 Tags: gutenberg, disable, disable gutenberg, editor, classic editor, block editor
     3Tags: classic editor, block editor, editor, gutenberg
    44Requires at least: 4.9
    55Tested up to: 6.7
    6 Stable tag: 1.6.6
     6Stable tag: 1.6.7
    77Requires PHP: 5.2.4
    88License: GPLv2 or later
     
    2929
    3030== Changelog ==
     31
     32= 1.6.7 =
     33* Fixed loading of script translations when post.js is replaced in WordPress 6.7.1.
    3134
    3235= 1.6.6 =
Note: See TracChangeset for help on using the changeset viewer.