WordPress at a glance
function is not described

rest_authorization_required_code() WP 4.7.0

Returns a contextual HTTP error code for authorization failure.

No Hooks.

Return

Int. 401 if the user is not logged in, 403 if the user is logged in.

Usage

rest_authorization_required_code();

Changelog

Since 4.7.0 Introduced.

Code of rest_authorization_required_code() WP 5.7.2

<?php
function rest_authorization_required_code() {
	return is_user_logged_in() ? 403 : 401;
}