ACF_Ajax_Check_Screen::user_can_set_post_status
Returns true if the user can give the post a status in the editor.
Метод класса: ACF_Ajax_Check_Screen{}
Хуков нет.
Возвращает
boolean.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->user_can_set_post_status( $post, $post_status );
- $post(WP_Post) (обязательный)
- The post being edited.
- $post_status(строка) (обязательный)
- The status.
Список изменений
| С версии 6.8.11 | Введена. |
Код ACF_Ajax_Check_Screen::user_can_set_post_status() ACF Ajax Check Screen::user can set post status ACF 6.8.11
protected function user_can_set_post_status( $post, $post_status ) {
if ( $post_status === $post->post_status ) {
return true;
}
// Registered statuses that aren't internal (such as trash or auto-draft), including custom ones.
if ( ! in_array( $post_status, get_post_stati( array( 'internal' => false ) ), true ) ) {
return false;
}
// Statuses that publish the post need the post type's publish capability.
if ( in_array( $post_status, array( 'publish', 'future', 'private' ), true ) ) {
$post_type = get_post_type_object( $post->post_type );
return $post_type && current_user_can( $post_type->cap->publish_posts );
}
return true;
}