wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_check_post_lock › WordPress Function
Seit2.5.0
Veraltetn/v
› wp_check_post_lock ( $post )
Parameter: |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: |
Determines whether the post is currently being edited by another user.
Ähnliche Funktionen: wp_set_post_lock, wp_refresh_post_lock, wp_check_comment_flood, wp_check_password, wp_get_first_block
Quellcode
function wp_check_post_lock( $post ) { $post = get_post( $post ); if ( ! $post ) { return false; } $lock = get_post_meta( $post->ID, '_edit_lock', true ); if ( ! $lock ) { return false; } $lock = explode( ':', $lock ); $time = $lock[0]; $user = isset( $lock[1] ) ? (int) $lock[1] : (int) get_post_meta( $post->ID, '_edit_last', true ); if ( ! get_userdata( $user ) ) { return false; } /** This filter is documented in wp-admin/includes/ajax-actions.php */ $time_window = apply_filters( 'wp_check_post_lock_window', 150 ); if ( $time && $time > time() - $time_window && get_current_user_id() !== $user ) { return $user; } return false; }