Filter hook 'customize_changeset_branching'

in WP Core File wp-includes/class-wp-customize-manager.php at line 811

View Source

customize_changeset_branching

Filter Hook
Description
Filters whether or not changeset branching is allowed. By default in core, when changeset branching is not allowed, changesets will operate linearly in that only one saved changeset will exist at a time (with a 'draft' or 'future' status). This makes the Customizer operate in a way that is similar to going to "edit" to one existing post: all users will be making changes to the same post, and autosave revisions will be made for that post. By contrast, when changeset branching is allowed, then the model is like users going to "add new" for a page and each user makes changes independently of each other since they are all operating on their own separate pages, each getting their own separate initial auto-drafts and then once initially saved, autosave revisions on top of that user's specific post. Since linear changesets are deemed to be more suitable for the majority of WordPress users, they are the default. For WordPress sites that have heavy site management in the Customizer by multiple users then branching changesets should be enabled by means of this filter.

Hook Information

File Location wp-includes/class-wp-customize-manager.php View on GitHub
Hook Type Filter
Line Number 811

Hook Parameters

Type Name Description
bool $allow_branching Whether branching is allowed. If `false`, the default, then only one saved changeset exists at a time.
WP_Customize_Manager $wp_customize Manager instance.

Usage Examples

Basic Usage
<?php
// Hook into customize_changeset_branching
add_filter('customize_changeset_branching', 'my_custom_filter', 10, 2);

function my_custom_filter($allow_branching, $wp_customize) {
    // Your custom filtering logic here
    return $allow_branching;
}

Source Code Context

wp-includes/class-wp-customize-manager.php:811 - How this hook is used in WordPress core
<?php
 806  		 *
 807  		 * @param bool                 $allow_branching Whether branching is allowed. If `false`, the default,
 808  		 *                                              then only one saved changeset exists at a time.
 809  		 * @param WP_Customize_Manager $wp_customize    Manager instance.
 810  		 */
 811  		$this->branching = apply_filters( 'customize_changeset_branching', $this->branching, $this );
 812  
 813  		return $this->branching;
 814  	}
 815  
 816  	/**

PHP Documentation

<?php
/**
		 * Filters whether or not changeset branching is allowed.
		 *
		 * By default in core, when changeset branching is not allowed, changesets will operate
		 * linearly in that only one saved changeset will exist at a time (with a 'draft' or
		 * 'future' status). This makes the Customizer operate in a way that is similar to going to
		 * "edit" to one existing post: all users will be making changes to the same post, and autosave
		 * revisions will be made for that post.
		 *
		 * By contrast, when changeset branching is allowed, then the model is like users going
		 * to "add new" for a page and each user makes changes independently of each other since
		 * they are all operating on their own separate pages, each getting their own separate
		 * initial auto-drafts and then once initially saved, autosave revisions on top of that
		 * user's specific post.
		 *
		 * Since linear changesets are deemed to be more suitable for the majority of WordPress users,
		 * they are the default. For WordPress sites that have heavy site management in the Customizer
		 * by multiple users then branching changesets should be enabled by means of this filter.
		 *
		 * @since 4.9.0
		 *
		 * @param bool                 $allow_branching Whether branching is allowed. If `false`, the default,
		 *                                              then only one saved changeset exists at a time.
		 * @param WP_Customize_Manager $wp_customize    Manager instance.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-customize-manager.php
Related Hooks

Related hooks will be displayed here in future updates.