Skip to content

Commit

Permalink
Editor: Persist preferences in user meta.
Browse files Browse the repository at this point in the history
Adds a new feature to persist editor UI preferences between page loads and browsers.

* Adds a new preferences persistence API.
* Saves editor preferences in user meta instead of in browser's local storage.

Why?
Due to the transient nature of browser storage, this persistence is not as sticky as it is expected to be, including: switching browsers (unique storage between browsers), or using private browsing tabs (storage cleared between sessions), or the same user across a network of sites (storage unique by domain).

This is a backport from Gutenberg.[WordPress/gutenberg#39795 See WordPress/gutenberg PR 39795].

Props talldanwp, youknowriad, noisysocks, mamaduka, costdev, ironprogrammer, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54182


git-svn-id: http://core.svn.wordpress.org/trunk@53741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
hellofromtonya committed Sep 15, 2022
1 parent 21eb790 commit 8c85dde
Show file tree
Hide file tree
Showing 9 changed files with 1,034 additions and 33 deletions.
2 changes: 1 addition & 1 deletion wp-includes/assets/script-loader-packages.php

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -683,4 +683,7 @@
add_action( 'setup_theme', 'wp_enable_block_templates' );
add_action( 'wp_loaded', '_add_template_loader_filters' );

// User preferences.
add_action( 'init', 'wp_register_persisted_preferences_meta' );

unset( $filter, $action );
Loading

0 comments on commit 8c85dde

Please sign in to comment.