WordPress.org

Plugin Directory

Test out the new Plugin Directory and let us know what you think.

Customize Snapshots

Allow Customizer states to be drafted, and previewed with a private URL.

Customize Snapshots save the state of a Customizer session so it can be shared or even published at a future date. A snapshot can be shared with a private URL to both authenticated and non-authenticated users. This means anyone can preview a snapshot's settings on the front-end without loading the Customizer, and authenticated users can load the snapshot into the Customizer and publish or amend the settings at any time.

Snapshots are an implementation of key aspects of the customizer transactions proposal.

This plugin works well with Customizer Browser History, which ensures that URL in the browser corresponds to the current panel/section/control that is expanded, as well as the current URL and device being previewed.

Requires PHP 5.3+. Development of this plugin is done on GitHub. Pull requests welcome. Please see issues reported there before going to the plugin forum.

Persistent Object Caching

Plugins and themes may currently only use is_customize_preview() to decide whether or not they can store a value in the object cache. For example, see Twenty_Eleven_Ephemera_Widget::widget(). However, when viewing a snapshot on the frontend, the is_customize_preview() method will return false. Plugins and themes that store values in the object cache must either skip storing in the object cache when CustomizeSnapshots\is_previewing_settings() is true, or they should include the CustomizeSnapshots\current_snapshot_uuid() in the cache key.

Example of bypassing object cache when previewing settings inside the Customizer preview or on the frontend via snapshots:

if ( function_exists( 'CustomizeSnapshots\is_previewing_settings' ) ) {
    $bypass_object_cache = CustomizeSnapshots\is_previewing_settings();
} else {
    $bypass_object_cache = is_customize_preview();
}
$contents = null;
if ( ! $bypass_object_cache ) {
    $contents = wp_cache_get( 'something', 'myplugin' );
}
if ( ! $contents ) {
    ob_start();
    myplugin_do_something();
    $contents = ob_get_clean();
    echo $contents;
}
if ( ! $bypass_object_cache ) {
    wp_cache_set( 'something', $contents, 'myplugin', HOUR_IN_SECONDS );
}

Requires: 4.5.3 or higher
Compatible up to: 4.6.2
Last Updated: 5 months ago
Active Installs: 30+

Ratings

5 out of 5 stars

Support

1 of 1 support threads in the last two months have been marked resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1
100,1,1