404 (Not Found) Redirect
Get Redirect
Get current 404 redirect preferences for a given access level.
Endpoint
GET /aam/v2/redirect/not-found
curl --location 'https://example.xyz/wp-json/aam/v2/redirect/not-found?access_level=role&role_id=subscriber' \
--header 'Authorization: Bearer ***'
Parameters
| Params | 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”. |
Response Sample
{ "type": "default" }
Set Redirect
Set 404 redirect.
Endpoint
POST /aam/v2/redirect/not-found
curl --location 'https://example.xyz/wp-json/aam/v2/redirect/not-found?access_level=role&role_id=subscriber' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ***'' \
--data '{
"type": "url_redirect",
"redirect_url": "/documentation"
}'
Parameters
| Params | 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”. |
type |
Required. The redirect type. The allowed values are “page_redirect”, “url_redirect”, “trigger_callback”, “login_redirect” or “default”. |
redirect_page_id |
Conditionally required. The valid and existing page ID if the type equals to “page_redirect”. |
redirect_url |
Conditionally required. Valid URL or relative path on the website if the type equals to “url_redirect”. |
callback |
Conditionally required. The valid callback function if the type is “trigger_callback”. The value is sanitized with the is_callable PHP core function and checks only for valid syntax. |
Response Sample
{ "type": "url_redirect", "redirect_url": "/documentation" }
Reset Redirect
Endpoint
DELETE /aam/v2/redirect/not-found
curl --location --request DELETE 'https://example.xyz/wp-json/aam/v2/redirect/not-found?access_level=role&role_id=subscriber' \
--header 'Authorization: Bearer ****'
Parameters
| Params | 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”. |
Response Sample
{ "success": true }