rest_authorization_required_code(): int

In this article

Returns a contextual HTTP error code for authorization failure.

Return

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

Source

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

Changelog

VersionDescription
4.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.