wp_set_post_lock
函数
wp_set_post_lock ( $post )
- 参数
-
-
(int|WP_Post)
$post
ID or object of the post being edited.- Required: 是
-
(int|WP_Post)
- 返回值
-
- (array|false) { Array of the lock time and user ID. False if the post does not exist, or there is no current user. @type int $0 The current time as a Unix timestamp. @type int $1 The ID of the current user. }
- 定义位置
-
-
wp-admin/includes/post.php
, line 1683
-
wp-admin/includes/post.php
- 引入
- 2.5.0
- 弃用
- –
Marks the post as currently being edited by the current user.
function wp_set_post_lock( $post ) { $post = get_post( $post ); if ( ! $post ) { return false; } $user_id = get_current_user_id(); if ( 0 == $user_id ) { return false; } $now = time(); $lock = "$now:$user_id"; update_post_meta( $post->ID, '_edit_lock', $lock ); return array( $now, $user_id ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。