Give Editors access to Redirection

Redirection is a powerful tool allowing you to manage redirects for your WordPress site.  For a recent project we needed to allow users with a role of Editor to add and manage redirects, so we had to do a little plugin tweaking to get that access granted.  Here is what you need to do.

On line 121 of this file:
/wp-content/plugins/redirection/redirection.php

Replace this:

function admin_menu() {
  	add_management_page( __( "Redirection", 'redirection' ), __( "Redirection", 'redirection' ), "delete_others_pages", basename( __FILE__ ), array( &$this, "admin_screen" ) );
	}

With this:

function admin_menu() {
  	add_management_page( __( "Redirection", 'redirection' ), __( "Redirection", 'redirection' ), "manage_options", basename( __FILE__ ), array( &$this, "admin_screen" ) );
	}

On line 36 of this file:
/wp-content/plugins/redirection/ajax.php

Replace this:

function init() {
		if ( current_user_can( 'administrator' ) ) {
			$this->post = stripslashes_deep( $_POST );

			$this->register_ajax( 'red_log_show' );
			$this->register_ajax( 'red_log_hide' );
			$this->register_ajax( 'red_log_delete' );

With this:

function init() {
		if ( current_user_can( 'delete_others_pages' ) ) {
			$this->post = stripslashes_deep( $_POST );

			$this->register_ajax( 'red_log_show' );
			$this->register_ajax( 'red_log_hide' );
			$this->register_ajax( 'red_log_delete' );

The first edit above allows Editors to see the Redirection navigation item under the Tools menu in the admin area. The second edit allows Editors to add/edit/save redirects via the Redirection screen.

Check out these comments...

  1. Hi.

    In Version 3.2.1 the Redirection, what changes to be made.

    Tangs :-)

  2. Hector Pimentel on November 17th, 2011
  3. Thank you for this! But the top part should be flipped. You want to replace “manage_options” with “delete_others_pages”. If you do that it works!

  4. Travis on November 1st, 2012

You diggin' our post? Leave a comment and let us know...