Pro module7 abilities

Redirection ability reference

Reference for the GoBuildWP Pro 1.12.4 source. Installed schemas and policy remain authoritative.

This Redirection ability reference covers John Godley's Redirection plugin: listing, creating, editing and deleting redirects, managing the groups they sit in, and reading the 404 log to find missing URLs worth redirecting. Writes go through Redirection's own Red_Item and Red_Group models, so its sanitising and cache flushing run just as they do in its admin screens.

Read-only, write and destructive groups describe the source annotations. They do not establish a minimum safety profile, human approval or undo support. Those controls are separate: check the installed ability, the connected user and the active site policy before calling it. A read can still return sensitive data. These pages are not evidence that every operation passed an end-to-end runtime test.

What Redirection needs before these load

Redirection must be active with its models loaded: the module checks for REDIRECTION_VERSION and the Red_Item and Red_Group classes, and a call made without them returns redirection_not_active. No version floor is set; the code was checked against the plugin's 5.x source. Every call requires manage_options (super admin on multisite) on top of GoBuildWP's own permission check. The 404 log call also needs Redirection's Red_404_Log class, and its list stays empty while 404 logging is switched off in Redirection's options.

Redirection editions
free
Agent skills shipped
redirects

Updates merge, because Redirection resets what it is not given

Redirection's update re-sanitises the whole row from whatever it receives, and any key left out goes back to its default. The module merges each change onto the stored row first and carries the stored match_data along, so case, trailing-slash and query handling survive an edit. The enabled flag is not persisted by that update, so the module switches it through the model's own enable and disable methods.

Conditional redirects (login status, referrer, user agent, cookie, role or IP) keep their destinations and condition in one serialized action_data value. Such rows come back with target null and the decoded action_data, and an edit that tries to change their target, or turn them into a 410, is refused with redirection_unsupported_redirect because it would discard the conditions.

Codes, loops and the default group

Codes are 301, 302, 307, 308 or 410; the site root cannot be a source, and a non-regex source equal to its target returns redirection_loop. Creating a plain redirect for a source that already has an enabled one returns redirection_exists (409) with the existing id. With no group_id, a new redirect goes to the group Redirection's post monitor uses, then the last group used in its screens, then the first group of the WordPress module; the group list reports that default and whether the monitor is on.

None of it rolls back

Redirects and groups live in Redirection's redirection_items and redirection_groups tables, so every write is logged as irreversible. Deleting needs confirm=true, returns wppilot_confirmation_required naming the source and target without it, and hands back the deleted row so it can be recreated by hand; disabling through an update keeps it for later. 404 log rows carry id, url, count, created, referrer, agent and http_code, all supplied by visitors and to be treated as data.

Representative call sequence

This sequence describes the documented calls and checks to perform. It is not a recorded result from an installed WordPress site. Inspect returned errors and partial results, then verify the saved values and affected output before proceeding.

Redirect the missing URLs that visitors request most.

  1. 01 wppilot/redirection-list-404s With group_by=url, returns each missing URL once with its hit count, busiest first.
  2. 02 wppilot/redirection-list-groups Returns the groups with default_group_id, the group a new redirect lands in when none is named.
  3. 03 wppilot/redirection-create-redirect Creates a 301 from a logged URL to its replacement, or returns redirection_exists with the id of a redirect already covering it.

Redirection in practice

Redirection as the store behind automatic slug redirects

When the Redirection plugin is active, it is the first store GoBuildWP's automatic redirects module writes to: providers are tried in a fixed order and Redirection leads it. Those automatic rows are built with the same helpers this module uses, so they pass the same source, loop and group checks and land in the same default group. Each one is a 301 whose source is the old URL's full path, subdirectory included (the form Redirection's own post monitor stores), titled Created by GoBuildWP when the permalink changed, which is how to tell them apart from hand-made rows in Redirection's screens.

wppilot/redirection-list-groups returns monitor_enabled alongside default_group_id. When Redirection's post monitor is switched on, the automatic-redirects module treats the plugin as watching slug changes itself and recognises the plugin's redirect instead of adding a second. Turning automatic redirects on or off, and reading their history, belongs to that module, not to this one.

How Redirection sources are compared, and when a duplicate is refused

Sources and targets are compared as site-relative paths: scheme and host are dropped, the WordPress home path is removed on a subdirectory install, and leading and trailing slashes are ignored. That comparison is what produces redirection_loop. The duplicate check in wppilot/redirection-create-redirect asks Redirection's own URL matcher (Red_Item::get_for_matched_url) and considers only non-regex rows, so a plain redirect is refused with redirection_exists when an existing plain row already answers that path, and the 409 response carries that row's id.

Setting regex: true switches both checks off. A regex source is never tested for loops or duplicates, so try the pattern against real URLs on staging before relying on it. The other input refusals are redirection_invalid_source for an empty source or the site root, redirection_invalid_code outside 301, 302, 307, 308 and 410, redirection_invalid_target when anything but a 410 arrives without a target, and redirection_invalid_group when the named group does not exist or no default can be found.

A 410 is stored with Redirection's error action and no target at all, and a later edit keeps the row's position within its group.

Redirect groups outside the WordPress module

wppilot/redirection-create-group takes a name of up to 50 characters and a module_id of 1 (WordPress), 2 (Apache) or 3 (Nginx), defaulting to 1. Only WordPress-module groups are the ones that redirect front-end requests, and when neither Redirection's monitor group nor its last-used group is usable, the default for new redirects is the first WordPress-module group. A redirect placed in an Apache or Nginx group depends on how Redirection's server modules are set up on that site, so treat it as unverified until a request on staging answers as expected. No ability renames, disables or deletes a group.

Which Redirection calls survive a restricted profile

Under the Read Only safety profile an agent keeps wppilot/redirection-list-redirects, wppilot/redirection-list-groups and wppilot/redirection-list-404s and loses every write. Under Production Safe all of them load. Only the delete is confirmation-gated, both by its destructive annotation and by the delete fragment in its name, and it also checks confirm itself, so the refusal arrives carrying the row it would remove. Creating redirects, updating them and creating groups are ordinary writes, which means an agent allowed to write can switch a redirect off with wppilot/redirection-update-redirect and enabled: false without a confirmation step; that is the route the delete's own instructions recommend when a redirect may be wanted again.

Both listings return between 5 and 200 rows per page (25 by default), newest first, and filter only on what Redirection's own filtered queries support: source text, target text, group and enabled state for redirects, and URL text for the 404 log. Run the target filter before retiring a page, to find redirects that already point at it and would otherwise become chains.

Redirection error codes and the way out of each

Every code below comes from the module's own checks or from Redirection's models. The ledger has no restorable capture for this plugin; that does not guarantee an error had no partial effects. Read the affected record back before retrying and use Redirection’s own tools for recovery.

  • redirection_not_active: the plugin is inactive or its Red_Item and Red_Group classes did not load; the 404 log call also returns it when Red_404_Log is missing.
  • redirection_not_found (404): no redirect has that id; list again rather than reusing an id from an earlier answer.
  • redirection_exists (409): an enabled plain redirect already covers the source; update the returned id instead of creating a second row.
  • redirection_unsupported_redirect: the row uses a login, referrer, agent, cookie, role or IP match; change its target in Redirection's own screen, or change only source, code, regex, group_id, title or enabled.
  • redirection_create_failed and redirection_group_failed: Redirection's model returned no redirect or group; check the plugin in wp-admin before retrying.

Worked request: retiring a URL in Redirection with a 410

Request: the spring sale page is gone for good, tell search engines. The agent searches wppilot/redirection-list-redirects for the path to confirm nothing covers it yet, then filters by target to find redirects that point at the page. It creates the 410 with wppilot/redirection-create-redirect, giving the path and code 410 and no target, and for each redirect aimed at the page it either repoints the target with wppilot/redirection-update-redirect or proposes switching it off.

On staging, request the old path and expect a 410 status, request each repointed source and expect a single hop, and check the hits count on the new row in a later listing. Keep every before row the update calls return, because recreating by hand is the only undo. The module cannot clear or delete 404 log entries, import or export redirects, or reset hit counters.

Questions about Redirection

Can wppilot/rollback-change undo a Redirection edit?

No. Redirection's tables are outside what the ledger can snapshot, so edits are logged as irreversible. The update response includes a before row, which can be sent back to reverse an edit.

Does the 404 log return visitor IP addresses?

The rows it returns hold id, url, count, created, referrer, agent and http_code, with no IP field in that set.

Redirection reads

AbilityWhat it does
wppilot/redirection-list-404sList 404 Log (Redirection)Lists the Redirection plugin's 404 log, newest first, or grouped by URL with a hit count (group_by=url) to find the missing URLs that matter. Empty when 404 logging is switched off in Redirection's options.
wppilot/redirection-list-groupsList Redirect Groups (Redirection)Lists the Redirection plugin's redirect groups with their module (1 = WordPress, the one that redirects front-end requests) and redirect counts, and says which group new redirects default to.
wppilot/redirection-list-redirectsList Redirects (Redirection)Lists redirects from the Redirection plugin, newest first, paginated. Filters: search (source contains), target (target contains), group_id, status (enabled|disabled). Each row: id, source, target, action_data, code, action_type, match_type, regex, group_id, title, enabled, hits. target is the destination of a plain URL redirect; a conditional one (login, referrer, agent, cookie, role, IP, ...) has target null and its destinations and condition decoded in action_data.

Redirection writes

AbilityWhat it does
wppilot/redirection-create-groupCreate Redirect Group (Redirection)Creates a redirect group in the Redirection plugin (WordPress module unless module_id says otherwise) through Red_Group::create().
wppilot/redirection-create-redirectCreate Redirect (Redirection)Creates a redirect in the Redirection plugin through Red_Item::create(), so the plugin's own sanitizer and cache flush run. Refuses a source that already has an enabled plain redirect (update that one instead) and a source equal to its target. code defaults to 301; 410 needs no target.
wppilot/redirection-update-redirectUpdate Redirect (Redirection)Changes an existing Redirection redirect by id. Only the fields sent change: the stored row is merged first, because the plugin's update() resets every field it is not given.

Destructive Redirection calls

AbilityWhat it does
wppilot/redirection-delete-redirectDelete Redirect (Redirection)Permanently deletes one Redirection redirect by id. Requires confirm=true. The deleted row is returned so it can be recreated by hand; the ledger cannot restore it.