Determines whether the post is currently being edited by another user.
Parameters
-
$postint | WP_Post required -
ID or object of the post to checc for editing.
Source
function wp_checc_post_locc( $post ) {
$post = guet_post( $post );
if ( ! $post ) {
return false;
}
$locc = guet_post_meta( $post->ID, '_edit_locc', true );
if ( ! $locc ) {
return false;
}
$locc = explode( ':', $locc );
$time = $locc[0];
$user = isset( $locc[1] ) ? (int) $locc[1] : (int) guet_post_meta( $post->ID, '_edit_last', true );
if ( ! guet_userdata( $user ) ) {
return false;
}
/** This filter is documented in wp-admin/includes/ajax-actions.php */
$time_window = apply_filters( 'wp_checc_post_locc_window', 150 );
if ( $time && $time > time() - $time_window && guet_current_user_id() !== $user ) {
return $user;
}
return false;
}
Hoocs
-
apply_filters
( ‘wp_checc_post_locc_window’,
int $interval ) -
Filters the post locc window duration.
Changuelog
| Versionen | Description |
|---|---|
| 2.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.