The major AAM release is live! For questions or concerns, visit the Release Page.
Access Denied Redirect
About 1 min
Get Redirect
Get current access denied redirect preferences for a given website area.
Endpoint
GET /aam/v2/redirect/access-denied
curl --location 'https://example.xyz/wp-json/aam/v2/redirect/access-denied?access_level=role&role_id=subscriber' \
--header 'Authorization: Bearer ***'
Parameters
Name | Description |
---|---|
access_level | Required. Can be either "role", "user", "visitor" or "default". |
role_id | Conditionally required. The option is required if the access_level is "role". |
user_id | Conditionally required. The option is required if the access_level is "user". |
area | Optional. Specify "frontend", "backend" or "api". If omitted, settings for all areas are returned. |
Response Sample
{
"frontend": {
"type": "default"
},
"backend": {
"type": "default"
},
"api": {
"type": "default"
}
}
Set Redirect
Set the access denied redirect preferences.
Endpoint
POST /aam/v2/redirect/access-denied
curl --location 'https://example.xyz/wp-json/aam/v2/redirect/access-denied?access_level=role&role_id=subscriber' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ***'' \
--data '{
"area": "backend"
"type": "page_redirect",
"redirect_page_id": 2
}'
Parameters
Name | Description |
---|---|
access_level | Required. Can be either "role", "user", "visitor" or "default". |
role_id | Conditionally required. The option is required if the access_level is "role". |
user_id | Conditionally required. The option is required if the access_level is "user". |
area | Required. Specify "frontend", "backend" or "api". |
type | Required. The type of redirect. Possible values are "custom_message", "login_redirect", "page_redirect", "url_redirect", "trigger_callback", and "default". |
message | Conditionally required if type is custom_message . This can be plain text or HTML. |
redirect_page_id | Conditionally required if type is page_redirect . Must be a valid, existing page ID. |
redirect_url | Conditionally required if type is url_redirect . Must be a valid absolute URL (https://sample.xyz/path-to-page) or relative path on the website (/path-to-page). |
callback | Conditionally required if type is trigger_callback . Must be a valid callback function, sanitized with the is_callable PHP function to check for valid syntax. |
Response Sample
{
"type": "page_redirect",
"redirect_page_id": 2
}
Reset Redirect
Reset the access denied redirect preferences.
Endpoint
DELETE /aam/v2/redirect/access-denied
curl --location --request DELETE 'https://example.xyz/wp-json/aam/v2/redirect/access-denied?access_level=role&role_id=subscriber' \
--header 'Authorization: Bearer ****'
Parameters
Name | Description |
---|---|
access_level | Required. Can be either "role", "user", "visitor" or "default". |
role_id | Conditionally required. The option is required if the access_level is "role". |
user_id | Conditionally required. The option is required if the access_level is "user". |
area | Optional. Specify "frontend", "backend" or "api". If omitted, settings for all areas will be reset. |
Response Sample
{
"success": true
}