Filter hook 'override_post_lock'

in WP Core File wp-admin/includes/post.php at line 1868

View Source

override_post_lock

Filter Hook
Description
Filters whether to allow the post lock to be overridden. Returning false from the filter will disable the ability to override the post lock.

Hook Information

File Location wp-admin/includes/post.php View on GitHub
Hook Type Filter
Line Number 1868

Hook Parameters

Type Name Description
bool $override Whether to allow the post lock to be overridden. Default true.
WP_Post $post Post object.
WP_User $user The user with the lock for the post.

Usage Examples

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

function my_custom_filter($override, $post, $user) {
    // Your custom filtering logic here
    return $override;
}

Source Code Context

wp-admin/includes/post.php:1868 - How this hook is used in WordPress core
<?php
1863  		 *
1864  		 * @param bool    $override Whether to allow the post lock to be overridden. Default true.
1865  		 * @param WP_Post $post     Post object.
1866  		 * @param WP_User $user     The user with the lock for the post.
1867  		 */
1868  		$override = apply_filters( 'override_post_lock', true, $post, $user );
1869  		$tab_last = $override ? '' : ' wp-tab-last';
1870  
1871  		?>
1872  		<div class="post-locked-message">
1873  		<div class="post-locked-avatar"><?php echo get_avatar( $user->ID, 64 ); ?></div>

PHP Documentation

<?php
/**
		 * Filters whether to allow the post lock to be overridden.
		 *
		 * Returning false from the filter will disable the ability
		 * to override the post lock.
		 *
		 * @since 3.6.0
		 *
		 * @param bool    $override Whether to allow the post lock to be overridden. Default true.
		 * @param WP_Post $post     Post object.
		 * @param WP_User $user     The user with the lock for the post.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-admin/includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.