rest_authorization_required_code

函式
rest_authorization_required_code ( No parameters )
返回值
  • (int) 401 if the user is not logged in, 403 if the user is logged in.
定義位置
相關方法
rest_handle_options_requestwp_update_https_migration_requiredwp_is_authorize_application_password_request_validpost_password_requiredrest_validate_request_arg
引入
4.7.0
棄用
-

rest_authorization_required_code: 這個函式返回REST API中授權要求錯誤的HTTP狀態程式碼。預設情況下,它返回的狀態程式碼是401。

返回授權失敗的上下文HTTP錯誤程式碼。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function rest_authorization_required_code() {
return is_user_logged_in() ? 403 : 401;
}
function rest_authorization_required_code() { return is_user_logged_in() ? 403 : 401; }
function rest_authorization_required_code() {
	return is_user_logged_in() ? 403 : 401;
}

常見問題

FAQs
檢視更多 >