Simplify your WordPress workflow!
Build faster, cleaner, and more reliable WordPress websites using lightweight plugins designed for real-world workflows.
Get started nowCheck that the plugin is active first:
if ( function_exists( 'rb_redirection_add' ) ) {
// ...
}
Adds a redirect; returns its ID or a WP_Error (for example rb_redirection_exists when there already is a rule for the source).
rb_redirection_add( '/old-page', '/new-page', 301, array(
'origin' => 'my-plugin', // shown in the list; filter by it
'note' => 'Moved by My Plugin',
) );
// to a post: follows the post when its address changes
rb_redirection_add( '/old-page', '', 301, array( 'target_post_id' => 42 ) );
// a pattern
rb_redirection_add( '^/blog/(\d{4})/(.+)$', '/$2', 301, array( 'match_type' => 'regex' ) );
Arguments: match_type (exact, starts, contains, regex), target_post_id, origin, note, enabled.
The redirect an address would follow now, with to — where it sends the visitor — or null.
$redirect = rb_redirection_find( '/old-page' );
The plugin’s screen, for links from your plugin: rb_redirection_admin_url( 'log' ).
rb_redirection_added( $id, $row ) — a redirect was addedrb_redirection_before_redirect( $to, $code ) — a visitor is about to be redirectedrb_redirection_capability — who may manage redirects (default manage_options)rb_redirection_ignore_404( $ignore, $url ) — return true to keep an address out of the 404 logNamespace rb_redirection/v1, for users with the capability above:
| Route | Methods | |
|---|---|---|
/redirects |
GET, POST | list (search, origin, enabled, page, per_page, orderby), add |
/redirects/{id} |
GET, POST, DELETE | read, update, delete |
/redirects/bulk |
POST | action: enable, disable, delete; ids |
/test?url= |
GET | which redirect an address follows |
/export, /import |
GET, POST | CSV |
/404 |
GET, DELETE | the 404 log; clear it |
/404/delete |
POST | delete entries |
/settings |
GET, POST | the settings |
Duplicate Post RB uses rb_redirection_add() to redirect removed duplicates to the post that stays, with the origin duplicate-post-rb.
Build faster, cleaner, and more reliable WordPress websites using lightweight plugins designed for real-world workflows.
Get started now