WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Авторские Темы для WordPress
функция не описана

WP_REST_Posts_Controller::check_password_required() public WP 5.7.1

Override the result of the post password check for REST requested posts.

Allow users to read the content of password protected posts if they have previously passed a permission check or if they have the edit_post capability for the post being checked.

{} Это метод класса: WP_REST_Posts_Controller{}

Хуков нет.

Возвращает

true|false. Result of password check taking in to account REST API considerations.

Использование

$WP_REST_Posts_Controller = new WP_REST_Posts_Controller();
$WP_REST_Posts_Controller->check_password_required( $required, $post );
$required(true|false) (обязательный)
Whether the post requires a password check.
$post(WP_Post) (обязательный)
The post been password checked.

Список изменений

С версии 5.7.1 Введена.

Код WP_REST_Posts_Controller::check_password_required() WP 5.7.2

<?php
public function check_password_required( $required, $post ) {
	if ( ! $required ) {
		return $required;
	}

	$post = get_post( $post );

	if ( ! $post ) {
		return $required;
	}

	if ( ! empty( $this->password_check_passed[ $post->ID ] ) ) {
		// Password previously checked and approved.
		return false;
	}

	return ! current_user_can( 'edit_post', $post->ID );
}