Make WordPress Core

Changeset 54485


Ignore:
Timestamp:
10/11/2022 03:28:08 PM (22 months ago)
Author:
audrasjb
Message:

Editor: Reinstate old persistence system configuration for the block editor usage data.

In [54182], the configuration for the old preference persistence system was removed. This system is still used for block usage data (to show the most frequently used blocks in the inserter). Furthermore some plugins may use this persistence system.

This changeset reinstates the previous persistence system used by the "Most used blocks" feature in the block inserter.

Follow-up to [54182].

Props talldanwp.
Fixes #56778.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r54408 r54485  
    381381            wp_json_encode( $preload_data ),
    382382            $user_id
     383        )
     384    );
     385
     386    // Backwards compatibility - configure the old wp-data persistence system.
     387    $scripts->add_inline_script(
     388        'wp-data',
     389        implode(
     390            "\n",
     391            array(
     392                '( function() {',
     393                '   var userId = ' . get_current_user_ID() . ';',
     394                '   var storageKey = "WP_DATA_USER_" + userId;',
     395                '   wp.data',
     396                '       .use( wp.data.plugins.persistence, { storageKey: storageKey } );',
     397                '} )();',
     398            )
    383399        )
    384400    );
Note: See TracChangeset for help on using the changeset viewer.